简体   繁体   English

在OS X上冻结点数要求,NumPy和SciPy

[英]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. 我有一个pip需求文件,我正在使用virtualenv自动获取我的应用程序的依赖项。

The application depends on both NumPy and SciPy and as such my pip requirements file includes: 该应用程序依赖于NumPy和SciPy,因此我的pip要求文件包括:

numpy==1.5.0
scipy==0.8.0

However, when running this pip in a new virtualenv, the installation fails with the following error: 但是,在新的virtualenv中运行此pip时,安装失败并显示以下错误:

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. 这是因为SciPy需要在构建之前安装NumPy。 Therefore, if I remove SciPy and then manually add SciPy afterwards (pip install scipy), it works. 因此,如果我删除SciPy然后手动添加SciPy(pip install scipy),它就可以了。

How can I resolve this problem given that pip does not install in any particular order? 如果pip没有以任何特定顺序安装,我该如何解决这个问题?

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. Pip和setuptools不是标准工具 - 我们试图在良好的基础上支持它们,但它很脆弱。 In particular, because scipy setup.py needs numpy to run, it cannot work using the install_requires argument. 特别是,因为scipy setup.py需要numpy才能运行,所以使用install_requires参数无法工作。

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. 幸运的是,pip的最新开发版本按照需求文件中列出的顺序安装了软件包。

I updated with this command (it needs Mercurial since pip is hosted on Bitbucket ): 我用这个命令更新了(它需要Mercurial,因为pip托管在Bitbucket上 ):

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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