Installing numpy as a dependency with setuptools
This is a known issue, tracked on numpy/numpy #2434
.
I found a workaround for this: add numpy
to setup_requires
. Having it in both setup_requires
and install_requires
seems to work fine with the most recent version of setuptools
.
So, your setup.py
should look something like
setup( # Your setup specific stuff here setup_requires=["numpy"], # Just numpy here install_requires=["numpy"], # Add any of your other dependencies here)
Unless you have access to a binary distribution (pre-compiled/built) for numpy, you'll have to have the python headers available as it needs them to build numpy. This is why most package managers come with pre-compiled versions of these packages. For example you can apt-get install python-numpy
, link that into your virtualenv, and when you try to install your program with install_requires=['numpy']
it should see that it's already installed.
To install numpy
the setuptools will download the package and compile it from source. However, there are some prerequisites to compile numpy
, you can check it here.
_configtest.c:1:20: error: Python.h: No such file or directory
this error indicates that at least you do not have python-dev package installed(if you are using ubuntu/debian).