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

Python setuptools在安装过程中发现错误的软件包,python,python-2.7,setuptools,Python,Python 2.7,Setuptools,在中,我们使用带有install\u requires的setuptools来配置所需的软件包。特别是,我们在该列表中包括请求工具带和请求 当我们创建一个新的虚拟环境,然后运行python setup.py install时,它第一次失败,因为找不到所需的分发请求。这似乎是因为pip将请求工具带-0.3.1(注意空格)标识为包请求的正确匹配项 再次运行python setup.py install似乎毕竟安装了请求 下面是安装过程的完整日志 复制步骤: git克隆https://github.

在中,我们使用带有
install\u requires
的setuptools来配置所需的软件包。特别是,我们在该列表中包括
请求工具带
请求

当我们创建一个新的虚拟环境,然后运行
python setup.py install
时,它第一次失败,因为
找不到所需的分发请求。这似乎是因为
pip
请求工具带-0.3.1
(注意空格)标识为包
请求的正确匹配项

再次运行
python setup.py install
似乎毕竟安装了
请求

下面是安装过程的完整日志

复制步骤:

  • git克隆https://github.com/uwescience/myria-python.git
  • cdmyriapython
  • mkvirtualenv myria-python
  • python setup.py
整个实验室似乎都有这个问题,但是我们都使用安装了10.9或10.10的MacOSX。以下是我的机器规格:

  • OS X 10.10.1
  • Python 2.7.9(默认,2014年12月10日,23:46:04)
  • pip 1.5.6
  • mkvirtualenv 1.11.6
我还能够在我们的一台Ubuntu服务器上复制它:

  • Ubuntu 14.04.1 LTS\n\l
  • Python 2.7.6
  • pip 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
搜索请求工具带
阅读https://pypi.python.org/simple/requests_toolbelt/
最佳匹配:要求工具带0.3.1
正在下载https://pypi.python.org/packages/source/r/requests-toolbelt/requests-toolbelt-0.3.1.tar.gz#md5=e563377e46cd0be8c7b3ac144a65844c
处理请求-toolbelt-0.3.1.tar.gz
编写/var/folders/m_qltd_g_13qd1v5tvr4l6q2rc0000gn/T/easy_install-2lqn7g/requests-toolbelt-0.3.1/setup.cfg
运行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
未找到与“*.pyc”匹配的以前包含的目录
警告:manifest\u maker:manifest.in,第6行:“递归包含”预期。。。
警告:manifest\u maker:manifest.in,第7行:“递归包含”预期。。。
未找到与“docs/\u build”匹配的以前包含的目录
未设置zip_安全标志;正在分析存档内容。。。
将请求toolbelt 0.3.1添加到easy-install.pth文件
Installed/Users/dhalperi/Envs/myria-python2/lib/python2.7/site-packages/requests\u toolbelt-0.3.1-py2.7.egg
搜索请求
最佳匹配:要求工具带-0.3.1
正在下载https://pypi.python.org/packages/source/r/requests-toolbelt/requests-toolbelt-0.3.1.tar.gz#md5=e563377e46cd0be8c7b3ac144a65844c
处理请求-toolbelt-0.3.1.tar.gz
正在编写/var/folders/m_/qltd_g_13qd1v5tvr4l6q2rc0000gn/T/easy_install-LKxX9E/requests-toolbelt-0.3.1/setup.cfg
运行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
未找到与“*.pyc”匹配的以前包含的目录
警告:manifest\u maker:manifest.in,第6行:“递归包含”预期。。。
警告:manifest\u maker:manifest.in,第7行:“递归包含”预期。。。
未找到与“docs/\u build”匹配的以前包含的目录
未设置zip_安全标志;正在分析存档内容。。。
请求toolbelt 0.3.1已经是easy-install.pth中的活动版本
Installed/Users/dhalperi/Envs/myria-python2/lib/python2.7/site-packages/requests\u toolbelt-0.3.1-py2.7.egg
错误:找不到所需的分发请求
如何修复此问题,使软件包在不运行setup.py两次的情况下安装?

(镜像自)

数小时的谷歌搜索终于把我带到了这里 numpy线程:

为此,他们必须将numpy添加到
setup\u requires
install\u requires
,以解决类似问题。做 这与请求似乎起了作用。但是我有点 正如@Timusan在上文中所指出的,怀疑论者没有看到我们在未来的问题 第一名

我在Mac电脑和Ubuntu上都试过了,现在可以了
在两个系统上都从干净的VirtualNV安装。

正如其他人在评论中提到的,根本原因是python/pip版本有缺陷。Python2.7.6存在这个问题,但是当我升级到2.7.9时就不再有问题了。还要注意,默认情况下,
mkirtualenv
/usr/bin/python
中使用python,即使在
$PATH

中还有其他python版本,您是在运行
python setup.py安装
然后运行
pip setup.py安装
还是在运行
python setup.py安装
两次?在你的问题中,你首先直接提到Python,然后是Pip。我想我已经看过我自己的一个项目了。这可能是pip(或相关软件)中关于版本解析的错误。可以试试pip问题跟踪程序吗?尽管pip最近在这方面做得很好,但有时对包名中的大小写和破折号与下划线的混淆也会使Python PackageCGE安装人员感到困惑。我可以理解@Mikkoohtama所说的,我的一个项目也遇到了pip中的一个错误,这也是确切的结果。我已经在Python2.7.8上更新了Pip(1.5.6)的最新版本,这解决了这个问题。此外,我可以使用此版本的Pip完美地安装您所需的软件包,并使用2.7.8解释器直接安装您的完整软件包(Git repo)。我无法重现您的错误。我还尝试使用命令
python setup.py develope
安装(在一个新的干净的Virtualenv中),正如您在Github bug报告中所描述的那样,它也工作得很好,安装时没有任何错误。这是否与您的特定设置有关?您使用的是什么版本的Python?N