我正在使用pipenv
来处理Python软件包相关性。
Python软件包使用的两个软件包(分别名为pckg1
和pckg2
依赖于同一个名为pckg3
的软件包,但来自两个不同的版本。显示依赖项的树:
$ pipenv graph
pckg1==3.0.0
- pckg3 [required: >=4.1.0]
pckg2==1.0.2
- pckg3 [required: ==4.0.11]
尝试安装依赖项:
$ pipenv install
Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Hint: try $ pipenv lock --pre if it is a pre-release dependency.
Could not find a version that matches pckg3==4.0.11,==4.1.0,>=4.1.0 (from -r C:\Users\user\AppData\Local\Temp\pipenv-o7uxm080-requirements\pipenv-hwekv7dc-constraints.txt (line 2))
Tried: 3.3.1, 3.3.2, 3.3.3, 3.4.0, 3.4.2, 4.0.0, 4.0.0, 4.0.1, 4.0.1, 4.0.2, 4.0.2, 4.0.3, 4.0.3, 4.0.4, 4.0.4, 4.0.6, 4.0.6, 4.0.8, 4.0.8, 4.0.9, 4.0.9, 4.0.10, 4.0.10, 4.0.11, 4.0.11, 4.1.0, 4.1.0, 4.1.1, 4.1.1, 4.1.2, 4.1.2, 4.2.1, 4.2.1, 4.3.0, 4.3.0
There are incompatible versions in the resolved dependencies.
如建议的那样,pip install --skip-lock
可以解决问题,但依存关系树仍未解决。
我很想告诉Pipenv
覆盖pckg2
的要求,并指定pckg3>=4.1.0
。
如何解决?
答案 0 :(得分:5)
我一直都遇到那个错误。每次清除锁定文件中的缓存都是很不错的选择。
$ pipenv lock --pre --clear
答案 1 :(得分:4)
不能。目前,pipenv
并没有提供任何东西来明确覆盖需求约束。
作为一种解决方法,您可以将要覆盖的依赖项放到dev-packages
中,因为它们将被packages
覆盖,因此此Pipfile
应该安装pckg3>=4.1.0
:< / p>
# Pipfile
...
[packages]
pckg1 = "==3.0.0"
[dev-packages]
pckg2 = "==1.0.2"
如果您现在锁定并安装:
$ pipenv lock --dev
$ pipenv install --dev
需求==4.0.11
将被>=4.1.0
覆盖。如果您问我,这很丑陋,因为这不是开发包的目的,并且您正在更改项目中pckg2
依赖项的作用,但我在这里看不到任何更好的方法。
答案 2 :(得分:3)
当pipfile上的例程未完成时,此方法有效。
一旦我犯了一个错误并运行
pipenv install codecove # With an 'e' at the end
并且pipenv始终尝试成功完成安装,因为lib不存在。我用以下方法解决了这个问题:
pipenv uninstall codecove
,然后安装了codecov。
我尝试运行
pipenv lock --clear
pipenv lock --pre --clear
但是只有在使用错误名称卸载lib之后,我才成功。
答案 3 :(得分:1)
google-cloud-core
也有类似的问题。
$ pipenv lock
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Hint: try $ pipenv lock --pre if it is a pre-release dependency.
Could not find a version that matches google-cloud-core<0.29dev,<0.30dev,>=0.28.0,>=0.29.0
Tried: 0.20.0, 0.20.0, 0.21.0, 0.21.0, 0.22.0, 0.22.0, 0.22.1, 0.22.1, 0.23.0, 0.23.0, 0.23.1, 0.23.1, 0.24.0, 0.24.0, 0.24.1, 0.24.1, 0.25.0, 0.25.0, 0.26.0, 0.26.0, 0.27.0, 0.27.0, 0.27.1, 0.27.1, 0.28.0, 0.28.0, 0.28.1, 0.28.1, 0.29.0, 0.29.0
There are incompatible versions in the resolved dependencies.
已通过
解决答案 4 :(得分:1)
我也遇到了同样的情况,我正在使用Visual Studio Code,并且可以摆脱它:
,然后尝试为虚拟文件夹安装缺少的依赖项,并且很好,它对我有用。
答案 5 :(得分:0)
我对glob模块有类似的问题。我从Pipfile中删除了glob = "*"
,此后工作正常。
错误:
bash-4.2# pipenv lock --clear
Locking [dev-packages] dependencies…
✔ Success!
Locking [packages] dependencies…
✘ Locking Failed!
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/resolver.py", line 69, in resolve
[pipenv.exceptions.ResolutionFailure]: req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]: req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]: resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]: raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches glob
[pipenv.exceptions.ResolutionFailure]: No versions found
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: ERROR: Could not find a version that matches glob
No versions found
Was https://pypi.org/simple reachable?
[pipenv.exceptions.ResolutionFailure]: req_dir=requirements_dir
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 726, in resolve_deps
[pipenv.exceptions.ResolutionFailure]: req_dir=req_dir,
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps
[pipenv.exceptions.ResolutionFailure]: resolved_tree = resolver.resolve()
[pipenv.exceptions.ResolutionFailure]: File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pipenv/utils.py", line 395, in resolve
[pipenv.exceptions.ResolutionFailure]: raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: pipenv.exceptions.ResolutionFailure: ERROR: ERROR: Could not find a version that matches glob
[pipenv.exceptions.ResolutionFailure]: No versions found
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: ERROR: Could not find a version that matches glob
No versions found
Was https://pypi.org/simple reachable?
答案 6 :(得分:0)
如果出现类似以下错误:
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✘ Locking Failed!
对我来说,发生这种情况是因为底层虚拟环境未引用我的当前目录。
我通过将内容移动到新目录并删除旧目录来解决此问题。
我还必须删除Pipfile
和Pipfile.lock
,但不确定是否有必要。
答案 7 :(得分:0)
vi Pipfile并删除有问题的软件包。对我来说很好。
答案 8 :(得分:0)
pipenv lock
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Hint: try $ pipenv lock --pre if it is a pre-release dependency.
pipenv安装--clean
答案 9 :(得分:0)
在使用VS Code的Windows 10上,通过在Powershell中运行pipenv引起了很多混乱,我得到了一个全新的安装。我还删除了先前尝试的所有痕迹(新目录删除了先前的venvs)。
答案 10 :(得分:0)
这里没有任何东西适合我。最后,这解决了问题:
pip uninstall pipenv
pip install pipenv
答案 11 :(得分:0)
如果遇到Locking Failed!
错误:
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✘ Locking Failed!
清除pipfile.lock
上的缓存,卸载软件包并重新启动VM对我来说是个窍门。
尝试:
pipenv uninstall *YourPackage*
pipenv uninstall *YourPackage* --dev ##(if relevant to your package)
pipenv lock --clear
停止并销毁VMM
重新启动VM
答案 12 :(得分:0)
pip install -U pipenv
为我解决在 Ubuntu 21.04 - Hirsute Hippo - python 3.9.5 版
这个命令安装了这些包: