有时,尽管没有实际的版本冲突,但pip仍然抱怨相互冲突的依赖关系,例如,即使在将elastic-apm的特定版本从constraints.txt中完全删除之后(只是将其留在mypackage的setup.py中),它仍然失败如下:
ERROR: Cannot install elastic-apm because these package versions have conflicting dependencies.
The conflict is caused by:
mypackage 1.2.3 depends on elastic-apm
The user requested (constraint) elastic-apm
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts这是使用pip22.1.2&python3.10这样的命令(即使用一个本地的轮子文件夹,而不是PyPI)。
pip install -r requirements.txt -c constraints.txt --no-index --find-links LOCALDIR --no-cache-dir --isolated为什么pip抱怨相互冲突的依赖关系,而实际上根本没有要求特定的版本或范围,更别提冲突的版本了?
发布于 2022-10-25 08:15:21
事实证明,问题是LOCALDIR没有包含当前平台的轮子。
文件夹中包含了这个轮子,但没有对应的Windows轮子(我们的错误)
elastic_apm-6.10.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl然而,pip输出是非常误导的--这个问题与冲突的依赖无关,它根本找不到与必要平台相匹配的包--如果pip告诉您这一点,那就太好了。
我在https://github.com/pypa/pip/issues/11009上发布了类似的信息。
https://stackoverflow.com/questions/74190982
复制相似问题