Question

I have scipy as a dependency in my python program which I am trying to package using setuptools.

I used install_requires=['scipy','matplotlib'] in my setup.py.

On running python setup.py install

Processing dependencies for Bland==1.0.a.dev1
Searching for scipy
Reading http://pypi.python.org/simple/scipy/
Best match: scipy 0.13.3
Downloading https://pypi.python.org/packages/source/s/scipy/scipy-0.13.3.zip#md5=20ff3a867cc5925ef1d654aed2ff7e88
Processing scipy-0.13.3.zip

it goes on until it show 3 to 4 warnings and an error as follows

ages/numpy/distutils/system_info.py:1522: UserWarning: 
    Atlas (http://math-atlas.sourceforge.net/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [atlas]) or by setting
    the ATLAS environment variable.
  warnings.warn(AtlasNotFoundError.__doc__)
/home/storm/Documents/bland/local/lib/python2.7/site-packages/numpy/distutils/system_info.py:1531: UserWarning: 
    Blas (http://www.netlib.org/blas/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [blas]) or by setting
    the BLAS environment variable.
  warnings.warn(BlasNotFoundError.__doc__)
/home/storm/Documents/bland/local/lib/python2.7/site-packages/numpy/distutils/system_info.py:1534: UserWarning: 
    Blas (http://www.netlib.org/blas/) sources not found.
    Directories to search for the sources can be specified in the
    numpy/distutils/site.cfg file (section [blas_src]) or by setting
    the BLAS_SRC environment variable.
  warnings.warn(BlasSrcNotFoundError.__doc__)
error: 
    Blas (http://www.netlib.org/blas/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [blas]) or by setting
    the BLAS environment variable

I found this question, but this is installing scipy without setup.py which tells to download, and then compile the fortran files, and finally link them to one lib which must then be on your search path when installing scipy. But how am I supposed to do this from setup.py or is there a work around.

FYI: I am running this in virtualenv

Was it helpful?

Solution

As far as I can tell, you cannot use the setup.py to install system libraries. This mechanism is only thought for Python packages and their C extensions (which may define their own dependencies on C shared libraries, but this is not a solution here).

There are a number of solutions you may try but they are all outside the setup.py file:

  • create an installer (RPM, DEB or Windows package) where you define your dependency on the Atlas package. The system package manager (yum, apt-get, hmmm... nothing on Windows) is then in charge of finding the lib and installing it for your package.
    • RPM: remember you get a bdist_rpm command from the setup.py directly
    • Windows: remember you also get a bdist_msi command from the setup.py
    • DEB: the stdeb package create a bdist_deb command
  • use buildout as build mechanism
    • define Atlas as a part
    • use the cmmi recipe in order to download, configure, make and "make install" the Atlas tarball
    • set the os.environ ATLAS variable to the parts directory of your buildout inside your setup.py before you define your package's setup.
  • simply list Atlas as a dependency of your package and let your users install it. Keep the scipy dependency within your setup.py; that is the correct place, since it is a Python package.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top