scipy install on mountain lion failing

When I try to install scipy using pip install scipy it fails with the following traceback

Downloading/unpacking scipy
  Downloading scipy-0.10.1.tar.gz (6.2MB): 6.2MB downloaded
  Running setup.py egg_info for package scipy
    Running from scipy source directory.
    blas_opt_info:
      FOUND:
        extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
        define_macros = [('NO_ATLAS_INFO', 3)]
        extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']

    non-existing path in '/private/var/folders/rd/fplkflh93ls54kbl5ylphl4h0000gn/T/pip-build/scipy/scipy/io': 'docs'
    lapack_opt_info:
      FOUND:
        extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
        define_macros = [('NO_ATLAS_INFO', 3)]
        extra_compile_args = ['-msse3']

    umfpack_info:
      libraries umfpack not found in /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib
      libraries umfpack not found in /usr/local/lib
      libraries umfpack not found in /usr/lib
    /usr/local/lib/python2.7/site-packages/numpy/distutils/system_info.py:470: UserWarning:
        UMFPACK sparse solver (http://www.cise.ufl.edu/research/sparse/umfpack/)
        not found. Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [umfpack]) or by setting
        the UMFPACK environment variable.
      warnings.warn(self.notfounderror.__doc__)
      NOT AVAILABLE

    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/var/folders/rd/fplkflh93ls54kbl5ylphl4h0000gn/T/pip-build/scipy/setup.py", line 196, in <module>
        setup_package()
      File "/var/folders/rd/fplkflh93ls54kbl5ylphl4h0000gn/T/pip-build/scipy/setup.py", line 187, in setup_package
        configuration=configuration )
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/core.py", line 152, in setup
        config = configuration()
      File "/var/folders/rd/fplkflh93ls54kbl5ylphl4h0000gn/T/pip-build/scipy/setup.py", line 138, in configuration
        config.add_subpackage('scipy')
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
        caller_level = 2)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
        caller_level = caller_level + 1)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 908, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "scipy/setup.py", line 20, in configuration
        config.add_subpackage('special')
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
        caller_level = 2)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
        caller_level = caller_level + 1)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 908, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "/private/var/folders/rd/fplkflh93ls54kbl5ylphl4h0000gn/T/pip-build/scipy/scipy/special/setup.py", line 54, in configuration
        extra_info=get_info("npymath")
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 2220, in get_info
        pkg_info = get_pkg_info(pkgname, dirs)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/misc_util.py", line 2172, in get_pkg_info
        return read_config(pkgname, dirs)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/npy_pkg_config.py", line 390, in read_config
        v = _read_config_imp(pkg_to_filename(pkgname), dirs)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/npy_pkg_config.py", line 326, in _read_config_imp
        meta, vars, sections, reqs = _read_config(filenames)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/npy_pkg_config.py", line 309, in _read_config
        meta, vars, sections, reqs = parse_config(f, dirs)
      File "/usr/local/lib/python2.7/site-packages/numpy/distutils/npy_pkg_config.py", line 281, in parse_config
        raise PkgNotFound("Could not find file(s) %s" % str(filenames))
    numpy.distutils.npy_pkg_config.PkgNotFound: Could not find file(s) ['/usr/local/lib/python2.7/site-packages/numpy/core/lib/npy-pkg-config/npymath.ini']

I'm using Mountain Lion, and python 2.7.3 which I installed using homebrew, and numpy was installed using pip install numpy.

Why is the scipy install failing?


This seems to be an issue with pip and numpy, which doesn't copy the compiled libraries into the site-packages directory.

You could install using pip into a virtualenv (which worked for me) or install from source using the

python setup.py install

method.

There are some comments about issue here:

http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/


如果您使用自制软件,您可以尝试以下内容(感谢https://github.com/pypa/pip/issues/707):

brew tap samueljohn/homebrew-python
brew install numpy
brew install scipy

If you don't use virtualenv , then the least intrusive fix may be manually edit /usr/local/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/locations.py (Your pip version may vary). Just replace line 35 from:

build_prefix = os.path.join(tempfile.gettempdir(), 'pip-build') 

to:

build_prefix = os.path.realpath(os.path.join(tempfile.gettempdir(), 'pip-build')) 

After this change, you need to reinstall numpy ( pip uninstall numpy; pip install numpy ). The scipy can then be installed by pip correctly.

The issue is caused by a pip bug. And the solution above is according to the pip patch (suggested in the issue discussion mentioned by Lokkju) from github user qwcode. This patch seems to have been merged to main pip repository. However, I don't see an easy way to brew update pip since it's bundled with Python. So just manually making this simple fix works for me.

链接地址: http://www.djcxy.com/p/87170.html

上一篇: 我如何安装scipy,numpy和scikit

下一篇: scipy安装在山狮失败