Install python packages to correct anaconda environment

It looks like conda automatically adds pip to your conda environment, so after you source your conda environment, i.e.: source activate ~/anaconda/envs/dataset you should be able to install it like this: git clone git://github.com/pudo/dataset.git pip install ./dataset EDIT Here are the exact steps I took: $ conda create -p ~/anaconda/envs/py33 python=3.3 anaconda pip $ source … Read more

Using an extra python package index url with setup.py

If you’re the package maintainer, and you want to host one or more dependencies for your package somewhere other than PyPi, you can use the dependency_links option of setuptools in your distribution’s setup.py file. This allows you to provide an explicit location where your package can be located. For example: from setuptools import setup setup( … Read more

Why does “python setup.py sdist” create unwanted “PROJECT-egg.info” in project root directory?

This directory is created intentionally as part of the build process for a source distribution. A little gander at the developer guide for setuptools gives you a hint as to why: But, be sure to ignore any part of the distutils documentation that deals with MANIFEST or how it’s generated from MANIFEST.in; setuptools shields you … Read more

How may I override the compiler (GCC) flags that setup.py uses by default?

Prepend CFLAGS=”-O0″ before you run setup.py: % CFLAGS=”-O0″ python ./setup.py The -O0 will be appended to CFLAGS while compiling, therefore will override previous -O2 setting. Another way is add -O0 to extra_compile_args in setup.py: moduleA = Extension(‘moduleA’, ….., include_dirs = [‘/usr/include’, ‘/usr/local/include’], extra_compile_args = [“-O0”], ) If you want to remove all default flags, use: … Read more

distutils: How to pass a user defined parameter to setup.py?

As Setuptools/Distuils are horribly documented, I had problems finding the answer to this myself. But eventually I stumbled across this example. Also, this similar question was helpful. Basically, a custom command with an option would look like: from distutils.core import setup, Command class InstallCommand(Command): description = “Installs the foo.” user_options = [ (‘foo=’, None, ‘Specify … Read more

What is the difference between `extras_require()` and `install_requires()` in setup.py?

According to the setuptools documentation, extras_require A dictionary mapping names of “extras” (optional features of your project) to strings or lists of strings specifying what other distributions must be installed to support those features. and install_requires A string or list of strings specifying what other distributions need to be installed when this one is. The … Read more

pip install . creates only the dist-info not the package

Since the question has become quite popular, here are the diagnosis steps to go through when you’re missing files after installation. Imagine having an example project with the following structure: root ├── spam │ ├── __init__.py │ ├── data.txt │ ├── eggs.py │ └── fizz │ ├── __init__.py │ └── buzz.py ├── bacon.py └── setup.py … Read more

Difference between entry_points/console_scripts and scripts in setup.py?

The docs for the (awesome) Click package suggest a few reasons to use entry points instead of scripts, including cross-platform compatibility and avoiding having the interpreter assign __name__ to __main__, which could cause code to be imported twice (if another module imports your script) Click is a nice way to implement functions for use as … Read more

When to use pip requirements file versus install_requires in setup.py?

My philosophy is that install_requires should indicate a minimum of what you need. It might include version requirements if you know that some versions will not work; but it shouldn’t have version requirements where you aren’t sure (e.g., you aren’t sure if a future release of a dependency will break your library or not). Requirements … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)