【问题标题】:What is the actual meaning of Inclusive ordered comparison in python versionpython版本中包含有序比较的实际含义是什么
【发布时间】:2022-01-23 22:50:59
【问题描述】:

我在我的约束文件中指定了这个

asgiref==3.5.0

当我在 docker build 期间运行 pip3 install 时,它会抱怨

#12 24.67 ERROR: Cannot install -r /tmp/requirements.txt (line 16) because these package versions have conflicting dependencies.
#12 24.67 
#12 24.67 The conflict is caused by:
#12 24.67     django 3.2.11 depends on asgiref<4 and >=3.3.2
#12 24.67     The user requested (constraint) asgiref==3.5.0
#12 24.67 
#12 24.67 To fix this you could try to:
#12 24.67 1. loosen the range of package versions you've specified
#12 24.67 2. remove package versions to allow pip attempt to solve the dependency conflict
#12 24.67 
#12 24.67 ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

Pip3 版本为 21.2.4,Linux 版本为 18.04,Python 3.6.9

也许我一直误解&gt;=,我会认为asgiref==3.5.0 符合asgiref&lt;4 and &gt;=3.3.2 条件?

如果我指定asgiref==3.3.3asgiref==3.4.0,pip3 安装运行良好

我已经在本地安装了 3.5.0

【问题讨论】:

  • 在我使用 Python 3.9 的机器上,安装 django==3.2.11 会自行安装 asgiref==3.5.0 没有任何问题 (see)。使用干净的虚拟环境对其进行测试。
  • @H4iku 我在构建 docker 镜像时遇到了问题,很确定它是干净的。 Pip 版本是 21.2.4
  • 您请求的具体版本是否在您有问题的平台上实际可用?为什么不为您自己的要求也指定asgiref&gt;=3.3.2,您需要最新的吗?
  • 你是对的,我今天早上又遇到了同样的问题,它找不到版本3.5.0,但我出于某种原因在本地安装了它。

标签: python pip


【解决方案1】:

不确定我是否应该删除我的问题,但我想我会给出答案,所以万一其他人遇到同样的问题,我相信罪魁祸首是在 docker build 期间找不到指定的版本:

 > [ 8/12] RUN set -ex && pip3 install -I asgiref==3.5.0:                                                                                                  
#12 0.250 + pip3 install -I asgiref==3.5.0                                                                                                                 
#12 0.825 Looking in indexes: https://pypi.org/simple                                                                             
#12 1.051 ERROR: Could not find a version that satisfies the requirement asgiref==3.5.0 (from versions: 0.8, 0.9, 0.9.1, 0.10.0, 0.11.0, 0.11.1, 0.11.2, 0.12.0, 0.12.1, 0.13.0, 0.13.2, 0.13.3, 0.14.0, 1.0.0, 1.0.1, 1.1.0, 1.1.1, 1.1.2, 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.2.0, 2.3.0, 2.3.1, 2.3.2, 3.0.0, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.5, 3.2.6, 3.2.7, 3.2.8, 3.2.9, 3.2.10, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.1)
#12 1.052 ERROR: No matching distribution found for asgiref==3.5.0

我不知道为什么它找不到版本,也许该版本是特定于 OS/Python 的。但我检查了pypi index 似乎版本在那里并且没有绑定到特定的操作系统:

不管怎样,错误信息有点混乱,应该说找不到版本而不是“冲突版本”

我今天两次陷入这个陷阱,第一次是我的错误我为一个包设置了错误的版本。但是第二次(这个问题)我没有意识到这是同一个问题,因为我在本地安装了版本。

【讨论】:

  • 找不到asgiref==3.5.0的原因是你的Python版本。 It requires Python 3.7 or higher.
  • @H4iku 谢谢,我想如果需要 3.7 文件名应该是 py37 什么的?
  • 该包不是 Python 3.7 特定的。他们只放弃了对 Python 3.6 的支持,因为它已经达到了 end-of-life
  • 酷啊是的有道理。哈哈
猜你喜欢
  • 1970-01-01
  • 2023-04-01
  • 2012-10-07
  • 2021-10-07
  • 2013-01-04
  • 2015-02-21
  • 1970-01-01
  • 1970-01-01
  • 2016-03-24
相关资源
最近更新 更多