[英]pip complains about dependency versions but installs them anyway. Why?
I have a requirements file defined like this:我有一个这样定义的需求文件:
requirements.txt
botocore==1.15.11
docutils==0.16
When I hit pip install -r requirements.txt
I see this error:当我点击
pip install -r requirements.txt
我看到这个错误:
botocore 1.15.11 has requirement docutils<0.16,>=0.10, but you'll have docutils 0.16 which is incompatible.
However, when I hit pip list
I see this as the output:但是,当我点击
pip list
时,我将其视为 output:
botocore 1.15.11
docutils 0.16
jmespath 0.10.0
pip 18.1
python-dateutil 2.8.1
setuptools 40.6.2
six 1.15.0
urllib3 1.25.9
wheel 0.34.2
This indicates that the two dependencies were installed as per definition in the requirements.txt file.这表明这两个依赖项是按照 requirements.txt 文件中的定义安装的。 Why is complaining about it if it's not a problem?
如果没有问题,为什么还要抱怨呢? If it is a problem, how did they get installed?
如果有问题,它们是如何安装的?
There are some well-known issues (limitations and bugs) with pip 's current dependency solver. pip当前的依赖求解器存在一些众所周知的问题(限制和错误)。 A new (better) one is in progress.
一个新的(更好的)正在进行中。 It can already be tested.
它已经可以测试了。 More details in this answer and its links: https://stackoverflow.com/a/60926641/11138259
此答案及其链接中的更多详细信息: https://stackoverflow.com/a/60926641/11138259
With that said, these two requirements are incompatible:话虽如此,这两个要求是不相容的:
botocore==1.15.11
docutils==0.16
As can be seen in the setup.cfg
for botocore 1.15.11 :从 botocore 1.15.11的
setup.cfg
中可以看出:
[bdist_wheel]
universal = 1
[metadata]
requires-dist =
python-dateutil>=2.1,<3.0.0
jmespath>=0.7.1,<1.0.0
docutils>=0.10,<0.16
urllib3>=1.20,<1.25.8; python_version=='3.4'
urllib3>=1.20,<1.26; python_version!='3.4'
It's still possible to instruct pip to install such a combination (one that is advertised as not compatible) anyway.无论如何,仍然可以指示pip安装这样的组合(被宣传为不兼容的组合)。 And pip will warn about this conflict, as you showed in your question, or by running
pip check
(which by the way, as far as I know, as of today, uses the newer dependency resolution already):并且pip将警告此冲突,正如您在问题中所示,或者通过运行
pip check
(顺便说一下,据我所知,截至今天,它已经使用了较新的依赖解决方案):
$ pip check
botocore 1.15.11 has requirement docutils<0.16,>=0.10, but you have docutils 0.16.
The imports and the executed code might still work without any (apparent) issue though.不过,导入和执行的代码可能仍然可以正常工作,而不会出现任何(明显)问题。 For example: it could be that botocore 1.15.11 is not actually entirely incompatible with docutils 0.16 .
例如:可能botocore 1.15.11实际上与docutils 0.16并不完全不兼容。 Either the code path that would trigger an issue is not hit, or the restriction
docutils<0.16
was just made as a preventive measure.要么触发问题的代码路径没有命中,要么限制
docutils<0.16
只是作为预防措施。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.