在myria-python中,我们使用带有install_requires
的setuptools来配置所需的包。在我们特定的setup file中,我们在该列表中加入了requests-toolbelt
和requests
。
当我们创建新的虚拟环境然后运行python setup.py install
时,它首次使用Cannot find required distribution requests
失败。这种情况似乎是因为pip
将requests toolbelt-0.3.1
(请注意空格)标识为包requests
的正确匹配。
再次运行python setup.py install
似乎安装了requests
。
以下是a GitHub issue,其中包含安装过程的完整日志。
重现的步骤:
git clone https://github.com/uwescience/myria-python.git
cd myria-python
mkvirtualenv myria-python
python setup.py
整个实验室似乎都有这个问题,但我们所有人都使用安装了10.9或10.10的Mac OS X.这是我的机器规格:
我还可以在我们的一个Ubuntu服务器上复制它:
以下是错误日志的尾部:
Searching for requests-toolbelt
Reading https://pypi.python.org/simple/requests_toolbelt/
Best match: requests-toolbelt 0.3.1
Downloading https://pypi.python.org/packages/source/r/requests-toolbelt/requests-toolbelt-0.3.1.tar.gz#md5=e563377e46cd0be8c7b3ac144a65844c
Processing requests-toolbelt-0.3.1.tar.gz
Writing /var/folders/m_/qltd_g_13qd1v5tvr4l6q2rc0000gn/T/easy_install-2lqn7g/requests-toolbelt-0.3.1/setup.cfg
Running requests-toolbelt-0.3.1/setup.py -q bdist_egg --dist-dir /var/folders/m_/qltd_g_13qd1v5tvr4l6q2rc0000gn/T/easy_install-2lqn7g/requests-toolbelt-0.3.1/egg-dist-tmp-riz25e
no previously-included directories found matching '*.pyc'
warning: manifest_maker: MANIFEST.in, line 6: 'recursive-include' expects <dir> <pattern1> <pattern2> ...
warning: manifest_maker: MANIFEST.in, line 7: 'recursive-include' expects <dir> <pattern1> <pattern2> ...
no previously-included directories found matching 'docs/_build'
zip_safe flag not set; analyzing archive contents...
Adding requests-toolbelt 0.3.1 to easy-install.pth file
Installed /Users/dhalperi/Envs/myria-python2/lib/python2.7/site-packages/requests_toolbelt-0.3.1-py2.7.egg
Searching for requests
Best match: requests toolbelt-0.3.1
Downloading https://pypi.python.org/packages/source/r/requests-toolbelt/requests-toolbelt-0.3.1.tar.gz#md5=e563377e46cd0be8c7b3ac144a65844c
Processing requests-toolbelt-0.3.1.tar.gz
Writing /var/folders/m_/qltd_g_13qd1v5tvr4l6q2rc0000gn/T/easy_install-LKxX9E/requests-toolbelt-0.3.1/setup.cfg
Running requests-toolbelt-0.3.1/setup.py -q bdist_egg --dist-dir /var/folders/m_/qltd_g_13qd1v5tvr4l6q2rc0000gn/T/easy_install-LKxX9E/requests-toolbelt-0.3.1/egg-dist-tmp-3tgz5e
no previously-included directories found matching '*.pyc'
warning: manifest_maker: MANIFEST.in, line 6: 'recursive-include' expects <dir> <pattern1> <pattern2> ...
warning: manifest_maker: MANIFEST.in, line 7: 'recursive-include' expects <dir> <pattern1> <pattern2> ...
no previously-included directories found matching 'docs/_build'
zip_safe flag not set; analyzing archive contents...
requests-toolbelt 0.3.1 is already the active version in easy-install.pth
Installed /Users/dhalperi/Envs/myria-python2/lib/python2.7/site-packages/requests_toolbelt-0.3.1-py2.7.egg
error: Could not find required distribution requests
如何修复此问题,以便在不运行setup.py两次的情况下安装软件包?
答案 0 :(得分:3)
(从https://github.com/uwescience/myria-python/pull/35反映)
100个谷歌搜索的多个小时最终将我带到了这一点 numpy thread:
https://github.com/numpy/numpy/issues/2434
他们必须将numpy添加到setup_requires
AND install_requires
以解决类似问题。干
这个请求似乎有效。但是,我有点
怀疑@Timusan上面没有看到我们的问题
第一名。
我尝试使用我的Mac以及Ubuntu,现在我能够 在两个系统上安装干净的virtualenv。
答案 1 :(得分:0)
正如其他人在评论中提到的那样,根本原因是python / pip的错误版本。 python 2.7.6存在这个问题,但是当我升级到2.7.9时,不再存在问题。还要注意mkirtualenv
默认使用/usr/bin/python
中的python,即使$PATH
中还有其他python版本。