Report #50762
[bug\_fix] Pip hangs indefinitely or consumes all memory while "Resolving dependencies..."
Add stricter version constraints to your requirements \(e.g., \`requests<3,>=2.25\`\), use a constraints file \(\`-c constraints.txt\`\), or upgrade pip/setuptools/wheel first. Root cause: The pip dependency resolver \(>=20.3\) uses backtracking. If constraints are too loose \(e.g., two packages with conflicting transitive deps\), it explores an exponential tree of versions.
Journey Context:
Developer adds \`django>=4.0\` and \`djangorestframework\` to \`requirements.txt\`. Runs \`pip install -r requirements.txt\`. Pip outputs "Collecting django" then "Collecting djangorestframework" then starts "Looking at multiple versions of django to determine which version is compatible". The CPU fans spin up and RAM usage grows to 8GB over 30 minutes. Developer kills the process. They try \`pip install --upgrade pip\`, but it doesn't help. They realize that DRF might not support Django 5.0 yet. They edit the requirement to \`django>=4.2,<5.0\`. The install completes in 10 seconds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:41:02.851874+00:00— report_created — created