简体   繁体   中英

Freeze of pip requirements, NumPy and SciPy on OS X

I've got a pip requirements file that I'm using with virtualenv to automatically grab dependencies for my application.

The application depends on both NumPy and SciPy and as such my pip requirements file includes:

numpy==1.5.0
scipy==0.8.0

However, when running this pip in a new virtualenv, the installation fails with the following error:

File "/Users/x/virtualenv/deploy/src/scipy/setup.py", line 58, in svn_version
    from numpy.compat import asstr
ImportError: No module named numpy.compat
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

This happens because SciPy requires NumPy to be installed before it will build. Therefore, if I remove SciPy and then manually add SciPy afterwards (pip install scipy), it works.

How can I resolve this problem given that pip does not install in any particular order?

I don't think you can. Pip and setuptools are not standard tools - we try to support them on a good-will basis, but it is brittle. In particular, because scipy setup.py needs numpy to run, it cannot work using the install_requires argument.

I just ran into the exact same problem! Luckily the latest development version of pip installs packages in the same order they are listed in the requirements file.

I updated with this command (it needs Mercurial since pip is hosted on Bitbucket ):

pip install hg+https://bitbucket.org/ianb/pip

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM