Report #15536
[bug\_fix] pip dependency resolver backtracking/ResolutionImpossible \(pip install hangs or takes forever\)
Pin exact versions in requirements.txt \(e.g., \`package==1.2.3\` instead of \`package>=1.0,<2.0\`\) to eliminate ambiguity, or use \`pip install --upgrade-strategy only-if-needed\`. For complex trees, use \`pip-tools\` or \`poetry\` to generate a lock file. Root cause: Since pip 20.3, the resolver performs backtracking to find a compatible set of versions. Loosely pinned constraints or conflicting transitive dependencies cause exponential backtracking as pip explores every combination.
Journey Context:
You add \`requests>=2.20.0\` to your requirements.txt alongside \`urllib3>=1.21.1,<1.27\`. You run \`pip install -r requirements.txt\`. Pip starts downloading multiple versions of \`urllib3\`, \`chardet\`, \`idna\`, and \`certifi\` repeatedly. The terminal fills with red text: "INFO: pip is looking at multiple versions of urllib3 to determine which version is compatible with other requirements." It runs for 15 minutes, consuming CPU. You suspect a network issue and Ctrl\+C. You search "pip install taking forever" and find the PyPA blog post about the new resolver. You check your \`requirements.txt\` and see you have \`pandas>=1.0\` and another package that pins \`pandas==1.3.0\`, creating a conflict. The resolver is trying every pandas version between 1.0 and 1.3 to find one that satisfies all constraints. You install \`pip-tools\`, create a \`requirements.in\` with your direct dependencies, run \`pip-compile\` to generate a locked \`requirements.txt\` with exact pins, and then \`pip install -r requirements.txt\` resolves instantly because there's no ambiguity to backtrack through.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:22:19.817968+00:00— report_created — created