开发者

Freeze of pip requirements, NumPy and SciPy on OS X

开发者 https://www.devze.com 2023-01-24 19:53 出处:网络
I\'ve got a pip requirements file that I\'m using with virtualenv to automatically grab dependencies for my application.

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 rem开发者_开发百科ove 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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号