Bob Sacamano
Bob Sacamano

Reputation: 439

Python: Handling numpy, scipy and matplotlib dependencies in setup.py

I have a small project that uses:

import numpy as np
import _csv
from datetime import datetime, timedelta
from scipy.stats.stats import pearsonr
import matplotlib.pyplot as plt

so I've written a simple setup.py for it:

from setuptools import setup, find_packages


setup(
    install_requires=['numpy', 'matplotlib', "scipy"]
)

And when I run python setup.py install I get this error:

Searching for scipy
Reading https://pypi.python.org/simple/scipy/
Best match: scipy 0.19.0
Downloading https://pypi.python.org/packages/e5/93/9a8290e7eb5d4f7cb53b9a7ad7b92b9827ecceaddfd04c2a83f195d8767d/scipy-0.19.0.zip#md5=91b8396231eec780222a57703d3ec550
Processing scipy-0.19.0.zip
Writing /tmp/easy_install-EBVjVf/scipy-0.19.0/setup.cfg
Running scipy-0.19.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-EBVjVf/scipy-0.19.0/egg-dist-tmp-enWoYn
/tmp/easy_install-EBVjVf/scipy-0.19.0/setup.py:323: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
  warnings.warn("Unrecognized setuptools command, proceeding with "
/usr/lib64/python2.7/site-packages/numpy/distutils/system_info.py:1408: 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__)
/usr/lib64/python2.7/site-packages/numpy/distutils/system_info.py:1419: UserWarning: 
    Lapack (http://www.netlib.org/lapack/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [lapack]) or by setting
    the LAPACK environment variable.
  warnings.warn(LapackNotFoundError.__doc__)
/usr/lib64/python2.7/site-packages/numpy/distutils/system_info.py:1422: UserWarning: 
    Lapack (http://www.netlib.org/lapack/) sources not found.
    Directories to search for the sources can be specified in the
    numpy/distutils/site.cfg file (section [lapack_src]) or by setting
    the LAPACK_SRC environment variable.
  warnings.warn(LapackSrcNotFoundError.__doc__)
Warning: distutils distribution has been initialized, it may be too late to add an extension _vqWarning: distutils distribution has been initialized, it may be too late to add an extension _hierarchyWarning: distutils distribution has been initialized, it may be too late to add a subpackage clusterWarning: distutils distribution has been initialized, it may be too late to add a subpackage constantsWarning: distutils distribution has been initialized, it may be too late to add a library dfftpackWarning: distutils distribution has been initialized, it may be too late to add a library fftpackWarning: distutils distribution has been initialized, it may be too late to add an extension _fftpackWarning: distutils distribution has been initialized, it may be too late to add an extension convolveWarning: distutils distribution has been initialized, it may be too late to add a subpackage fftpackRunning from scipy source directory.
Warning: distutils distribution has been initialized, it may be too late to add a library machWarning: distutils distribution has been initialized, it may be too late to add a library quadpackWarning: distutils distribution has been initialized, it may be too late to add a library odepackWarning: distutils distribution has been initialized, it may be too late to add a library dopnon-existing path in 'scipy/integrate': 'quadpack.h'
Warning: distutils distribution has been initialized, it may be too late to add an extension _quadpackWarning: distutils distribution has been initialized, it may be too late to add an extension _odepackWarning: distutils distribution has been initialized, it may be too late to add an extension vodeWarning: distutils distribution has been initialized, it may be too late to add an extension lsodaWarning: distutils distribution has been initialized, it may be too late to add an extension _dopWarning: distutils distribution has been initialized, it may be too late to add an extension _test_multivariateWarning: distutils distribution has been initialized, it may be too late to add an extension _test_odeint_bandedWarning: distutils distribution has been initialized, it may be too late to add a subpackage integrateWarning: distutils distribution has been initialized, it may be too late to add a library fitpackWarning: distutils distribution has been initialized, it may be too late to add an extension interpndWarning: distutils distribution has been initialized, it may be too late to add an extension _ppolyWarning: distutils distribution has been initialized, it may be too late to add an extension _bsplWarning: distutils distribution has been initialized, it may be too late to add an extension _fitpackWarning: distutils distribution has been initialized, it may be too late to add an extension dfitpackWarning: distutils distribution has been initialized, it may be too late to add an extension _interpolateWarning: distutils distribution has been initialized, it may be too late to add a subpackage interpolateWarning: distutils distribution has been initialized, it may be too late to add an extension streamsWarning: distutils distribution has been initialized, it may be too late to add an extension mio_utilsWarning: distutils distribution has been initialized, it may be too late to add an extension mio5_utilsWarning: distutils distribution has been initialized, it may be too late to add a subpackage matlabWarning: distutils distribution has been initialized, it may be too late to add a subpackage arffWarning: distutils distribution has been initialized, it may be too late to add a subpackage harwell_boeingWarning: distutils distribution has been initialized, it may be too late to add a subpackage ioerror: no lapack/blas resources found

Is there something else I should be adding to the setup.py?

Upvotes: 1

Views: 734

Answers (1)

jobou
jobou

Reputation: 1863

It seems to be a problem of missing headers. You can try to install these packages :

sudo apt-get install libatlas-dev liblapack-dev

Upvotes: 4

Related Questions