setuptools在安装过程中发现错误的包

Dan*_*rin 11 python setuptools python-2.7

myria-python中,我们使用setuptools install_requires来配置所需的包.在我们特殊的安装文件,我们包括requests-toolbeltrequests在该列表中.

当我们创建一个新的虚拟环境然后运行时python setup.py install,它第一次就失败了Cannot find required distribution requests.这似乎是因为pip识别requests toolbelt-0.3.1(注意空格)作为包的正确匹配requests.

毕竟python setup.py install再次运行似乎安装requests.

这是一个GitHub问题,其中包含安装过程的完整日志.

重现步骤:

  • 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. 这是我的机器规格:

  • OS X 10.10.1
  • Python 2.7.9(默认,2014年12月10日,23:46:04)
  • 点1.5.6
  • mkvirtualenv 1.11.6

我还能够在我们的一个Ubuntu服务器上复制它:

  • Ubuntu 14.04.1 LTS \n\l
  • Python 2.7.6
  • 点1.5.4
  • mkvirtualenv 1.11.4

这是错误日志的尾部:

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
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题,以便在不运行setup.py两次的情况下安装软件包?

Dan*_*rin 4

(镜像自https://github.com/uwescience/myria-python/pull/35

经过数小时的数百次 Google 搜索,我最终找到了这个 numpy 线程:

https://github.com/numpy/numpy/issues/2434

为此,他们必须将 numpy 添加到setup_requires AND install_requires来解决类似的问题。通过请求执行此操作似乎有效。然而,我有点怀疑,正如@Timusan 上面指出的那样,他一开始就没有看到我们的问题。

我在 Mac 和 Ubuntu 上进行了尝试,现在可以在两个系统上从干净的 virtualenv 进行安装。