在myria-python中,我们将setuptools与install_requires
一起使用以配置所需的软件包。在我们特定的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 OSX。这是我机器的规范:
我还能够在我们的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?
最佳答案
(从https://github.com/uwescience/myria-python/pull/35镜像)
数百个小时的Google搜索最终导致我进入了这个过程
numpy线程:
https://github.com/numpy/numpy/issues/2434
为此,他们必须将numpy添加到setup_requires
和 install_requires
中,以解决类似的问题。正在做
这与请求似乎已经奏效。但是,我有点
@Timusan表示怀疑,上面没有看到我们的问题
第一名。
我在Mac和Ubuntu上都尝试过,现在能够
从干净的virtualenv在两个系统上安装。