python install_error ai_generated true

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. foo 1.0 requires bar<2, but you have bar 2.1 which is incompatible.

ID: python/pip-conflicting-dependencies-backtracking

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2024-09-14First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active
3.10 active
3.11 active
3.12 active

Root Cause

An existing environment already contains a package version that conflicts with a newly installed package; the resolver only warns rather than fixing the pre-existing install.

generic

中文

现有环境中已包含与新安装包冲突的包版本;解析器仅发出警告,而不会修复已有的安装。

Workarounds

  1. 95% success
    python -m venv .venv && source .venv/bin/activate
    pip install pip-tools
    pip-compile requirements.in
    pip-sync requirements.txt
  2. 90% success
    pip install 'foo==1.0' 'bar<2'
    pip check

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Upgrades both without regard to the constraint; may re-trigger the same conflict or introduce new ones.

  2. 85% fail

    Force-reinstall does not resolve version constraints; the same incompatible pair is reinstalled.