[英]Troubles while installing psutil (wheel) as a dependency via pip
I wrote a package with a dependency's dependency to psutil ( my-package
depends on third-party-package
which depends on psutil
). 我写了一个包依赖依赖于psutil
my-package
( my-package
依赖于依赖于psutil
third-party-package
)。
Since it's supposed to run on a server without any connectivity and without gcc
, I prepared the deployment locally with a psutil
python platform wheel and pip install my-package --download
, then sent everything on the server. 因为它应该在没有任何连接且没有
gcc
的服务器上运行,所以我使用psutil
python平台轮在本地准备部署并且pip install my-package --download
,然后在服务器上发送所有内容。
Now everything is ready on the server, but for some reason, when I run the installation, pip
refuses to install psutil
. 现在一切都在服务器上准备就绪,但出于某种原因,当我运行安装时,
pip
拒绝安装psutil
。 Note that the server is a red hat 7.2 running pip 7.1.0, virtualenv 1.10.1 and python 2.7.5 (and I can't change the version of anything). 请注意,服务器是一个red hat 7.2运行pip 7.1.0, virtualenv 1.10.1和python 2.7.5(我无法更改任何版本)。
$ pip install /tmp/python_packages/my-package-1.4.zip --no-index
--find-links /tmp/python_packages/ --use-wheel
Ignoring indexes: https://pypi.python.org/simple/
# blablabla, everything goes fine, then
Downloading/unpacking psutil (from third-party-package>=0.9->my-package==1.4)
Could not find any downloads that satisfy the requirement psutil
(from third-party-package>=0.9->my-package==1.4)
Cleaning up...
No distributions at all found for psutil (from third-party-package>=0.9->my-package==1.4)
Storing complete log in /home/anto/.pip/pip.log
Here is what pip.log
says: 这是
pip.log
所说的:
Downloading/unpacking psutil (from third-party-package>=0.9->my-package==1.4)
URLs to search for versions for psutil (from third-party-package>=0.9->my-package==1.4):
# bla
Skipping file:///tmp/python_packages/psutil-4.2.0-cp27-cp27mu-linux_x86_64.whl
because it is not compatible with this Python
# bla
Could not find any downloads that satisfy the requirement psutil (from third-
party-package>=0.9->my-package==1.4)
Cleaning up...
So "not compatible with this Python", ok. 所以“与这个Python不兼容”,好吧。 But here is the really weird part: if I install
psutil
without anything else, and then the rest, everything goes fine. 但这里有一个非常奇怪的部分:如果我没有任何其他东西安装
psutil
,那么其余部分,一切都很顺利。
$ pip install /tmp/python_packages/psutil-4.2.0-cp27-cp27mu-linux_x86_64.whl
Unpacking /tmp/python_packages/psutil-4.2.0-cp27-cp27mu-linux_x86_64.whl
Installing collected packages: psutil
Successfully installed psutil
Cleaning up...
$ pip freeze -l
psutil==4.2.0
$ pip install /tmp/python_packages/my-package-1.4.zip --no-index
--find-links /tmp/python_packages/ --use-wheel
# blablabla
Successfully installed my-package third-party-package
Cleaning up...
What am I missing ? 我错过了什么? Any clue ?
任何线索?
The key issue you are facing is IMHO this: 你面临的关键问题是恕我直言:
Skipping file:///tmp/python_packages/psutil-4.2.0-cp27-cp27mu-linux_x86_64.whl
because it is not compatible with this Python
A new recent feature has been introduced in pip to support "many linux" wheels (See this PEP ) 最新功能已在pip中引入,以支持“许多linux”轮(参见此PEP )
When asking for a direct install of wheel, minimal checks are done and pip assumes you really want this installed. 当要求直接安装车轮时,会进行最少的检查,并且pip假定您确实希望安装此车轮。
When a wheel is installed indirectly as a dep of a dep in your case, there may be incompatible tags in this context. 如果在您的情况下间接安装车轮作为dep的dep,则在此上下文中可能存在不兼容的标签。
I would ensure that I use the latest version of pip, setuptools and virtualenv to remove moving parts and it may fix you problem. 我会确保使用最新版本的pip,setuptools和virtualenv来移除移动部件,它可能会解决您的问题。
Vaguely related, and if this can help, I use this script with a Linux/Mac or Windows wrapper to perform consistent install of vendored pip packages. 模糊相关,如果这可以提供帮助,我将此脚本与Linux / Mac或Windows包装器一起使用来执行一致安装的销售pip包。 The key point is to vendor everything and this may be another reason why you get some failure.
关键是供应商的一切,这可能是你失败的另一个原因。
Make sure that the version of wheel you use to create the wheel is the same as the version used during deployment. 确保用于创建滚轮的滚轮版本与部署期间使用的版本相同。
I experienced the same problem when trying to deploy a wheel built with 0.29.0, using wheel 0.24.0. 当我尝试使用0.24.0车轮部署使用0.29.0构建的车轮时,我遇到了同样的问题。
I downgraded the version of wheel used to build the wheel to match the version used during deployment, and this resolved the problem. 我降级了用于构建轮子的轮子版本以匹配部署期间使用的版本,这解决了问题。
From your answer, it seems that you got it working with the extra step. 从你的答案来看,你似乎已经完成了额外的步骤。
When doing an offline install, you need to tell it where to find all the packages you want to install explicitly, not just the top level. 在进行离线安装时,您需要告诉它在哪里可以找到您要明确安装的所有软件包,而不仅仅是顶级软件。
I personally have always been explicit about the fact you are looking in the file, and like any other pip install you can specify multiple installs on the same line for context. 我个人一直明确表示您正在查看该文件,并且像任何其他pip安装一样,您可以在同一行上为上下文指定多个安装。
$ pip install --no-index --find-links file:/tmp/python_packages/ --use-wheel psutil my-package-1.4.zip
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.