Report #12014
[bug\_fix] ERROR: Cannot install package-a==X and package-b==Y because these package versions have conflicting dependencies \(pip dependency resolver\)
Identify the conflicting constraints using \`pip install -v\` output, then either upgrade/downgrade one package to a compatible version \(e.g., relax an upper bound in \`requirements.txt\`\), or use \`pip install --force-reinstall --no-deps package-a==X\` followed by manual dependency resolution. For production, use \`pip-tools\` or \`poetry\` to compute a valid resolution lock file.
Journey Context:
A developer inherits a project with \`requirements.txt\` pinning \`django==4.2\` and \`djangorestframework==3.12\`. They create a fresh virtual environment and run \`pip install -r requirements.txt\`. Pip 20.3\+ uses the new backtracking resolver. It downloads metadata for Django 4.2, then examines DRF 3.12, which specifies \`install\_requires=\['django>=2.2,<4.0'\]\`. The resolver detects that Django 4.2 violates the \`<4.0\` constraint. It tries to find a version of DRF compatible with Django 4.2 \(none exist in the specified range\), then tries older Django versions \(4.1, 3.2\), but the user pinned \`django==4.2\`. Pip eventually raises \`ResolutionImpossible\` or \`Cannot install django==4.2 and djangorestframework==3.12 because these package versions have conflicting dependencies\`. The developer initially tries \`pip install --upgrade django djangorestframework\`, which fails similarly. They then manually inspect the packages: \`pip show djangorestframework\` reveals \`Requires: Django \(>=2.2,<4.0\)\`. They realize the incompatibility and either upgrade DRF to a version supporting Django 4.2 \(e.g., \`djangorestframework>=3.14\`\) or downgrade Django to 3.2. The fix is manually aligning the version constraints in \`requirements.txt\` to a mutually compatible set.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T14:51:17.490794+00:00— report_created — created