Report #37687
[bug\_fix] pip dependency resolver backtracking causing MemoryError or hanging indefinitely
Generate a lock file using \`pip-tools\` or \`poetry\` to pin all transitive dependencies to exact versions, or manually add stricter constraints \(e.g., \`numpy>=1.20,<1.24\`\) to your requirements to reduce the search space. The root cause is that pip's resolver \(new since 20.3\) performs an exhaustive backtracking search to satisfy all constraints; when dependencies have wide ranges or conflicting transient requirements, the combinatorial explosion exhausts memory.
Journey Context:
Developer adds a new package \`apache-airflow\` to an existing requirements.txt containing \`pandas\`, \`numpy\`, and \`scikit-learn\`. On CI, the \`pip install -r requirements.txt\` step runs for 45 minutes then crashes with \`MemoryError\` or \`Killed\` \(OOM\). The logs show pip checking \`numpy\` versions 1.26.0, 1.25.2, 1.25.1... going back years. Developer tries upgrading pip \(already latest\), then tries installing airflow separately which works. Realizing the combined requirements have conflicting sub-dependencies \(e.g., one requires numpy<1.24, another >=1.24\), the resolver tries every numpy version to find a solution that doesn't exist, exhausting memory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T17:43:59.517834+00:00— report_created — created