我在安装mmdet的时候遇到一个问题:

  WARNING: Requested mmdet==1.0rc4 from https://pypi.tuna.tsinghua.edu.cn/packages/25/d3/c9694e695191cfa39cd45b615eebfc349b74b66e4a531a531246f47ddf68/mmdet-1.0rc4.tar.gz#sha256=879e98db69684856413a0b0be835112ae7de9204d4b28c811f1fe0969b7ffb8c, but installing version 1.0rc3
Discarding https://pypi.tuna.tsinghua.edu.cn/packages/25/d3/c9694e695191cfa39cd45b615eebfc349b74b66e4a531a531246f47ddf68/mmdet-1.0rc4.tar.gz#sha256=879e98db69684856413a0b0be835112ae7de9204d4b28c811f1fe0969b7ffb8c (from https://pypi.tuna.tsinghua.edu.cn/simple/mmdet/): Requested mmdet==1.0rc4 from https://pypi.tuna.tsinghua.edu.cn/packages/25/d3/c9694e695191cfa39cd45b615eebfc349b74b66e4a531a531246f47ddf68/mmdet-1.0rc4.tar.gz#sha256=879e98db69684856413a0b0be835112ae7de9204d4b28c811f1fe0969b7ffb8c has inconsistent version: expected '1.0rc4', but metadata has '1.0rc3'
ERROR: Could not find a version that satisfies the requirement mmdet==1.0rc4 (from versions: 0.6.0, 0.6.1, 0.6.2, 1.0rc2, 1.0rc3, 1.0rc4, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.7.0, 2.8.0, 2.9.0, 2.10.0, 2.11.0, 2.12.0, 2.13.0, 2.14.0, 2.15.0, 2.15.1, 2.16.0, 2.17.0, 2.18.0, 2.18.1, 2.19.0, 2.19.1, 2.20.0, 2.21.0, 2.22.0, 2.23.0, 2.24.0, 2.24.1, 2.25.0, 2.25.1, 2.25.2, 2.25.3, 2.26.0, 2.27.0, 2.28.0, 2.28.1, 2.28.2, 3.0.0rc0, 3.0.0rc1, 3.0.0rc2, 3.0.0rc3, 3.0.0rc4, 3.0.0rc5, 3.0.0rc6)
ERROR: No matching distribution found for mmdet==1.0rc4

核心的问题是:

has inconsistent version: expected '1.0rc4', but metadata has '1.0rc3'

也就是说我指定安装的是1.0rc4的版本,但是依赖包里面的版本是1.0rc3,这背后的原因是pip修正了版本校验规则,具体可以看:

https://github.com/pypa/pip/issues/9186
https://github.com/pypa/pip/issues/9203

这2个issue,修正后,对已经存在,且没有遵守规定的包,就不是很友好,解决这个问题的话,可以跳过这个校验:

pip install mmdet==1.0rc4 --use-deprecated=legacy-resolver

这样可以强制不使用版本校验。


扫码手机观看或分享: