pip: ResolutionImpossible when two requirements pin the same package
One pin too tight breaks the whole install. Read the chain, pick the side that should move, and make the resolution reproducible with a lock.

Introduction & Quick Summary
Symptom. Installing a project's dependencies in one command fails, and pip prints the same wall of text however you phrase the request:
ERROR: Cannot install myapp==2.1.0 because these package versions have
conflicting dependencies.
The conflict is caused by:
The user requested pydantic==2.9.2
fastapi 0.112.0 depends on pydantic!=1.8,!=1.8.1,<3.0.0,>=1.7.4
...On pip's newer resolver the exception is reported as ResolutionImpossible, often with a chain of The user requested and X depends on lines and no single obvious culprit. Installing packages one at a time succeeds, and then something else breaks.
Cause. A dependency graph with no satisfying assignment: two requirements pin incompatible versions of the same package, or a marker/extra combination makes two branches active for the same environment. pip backtracked, found no combination that satisfies every constraint, and reported the last conflict it hit, which is not necessarily the first one.
Fix. Read the report as constraints, not as instructions, and let a lockfile or a resolver tool do the search:
# 1. what actually requires the conflicting package
pip install --dry-run --report - pydantic==2.9.2 2>/dev/null | python3 -m json.tool | head -40
pipdeptree --warn silence | grep -A2 -B2 pydantic# 2. let a resolver produce a consistent set, then freeze it
pip install -U pip
pip install "fastapi==0.112.0" "pydantic>=2.9,<3"
pip freeze > requirements.lock# 3. pyproject: keep one source of truth per dependency
[project]
dependencies = [
"fastapi==0.112.0",
"pydantic>=2.9,<3",
]The rest of this guide is about reading the conflict chain, the four situations that produce it most often, and why the popular workarounds hide the problem instead of solving it.
Core Mechanics, Signatures & Reproducible Setup
pip's resolver collects requirements, picks candidate versions, and backtracks when a choice makes another requirement unsatisfiable. ResolutionImpossible means every branch of that search failed. The report lists the constraints involved, and the useful part is the last two or three lines before the error, because those are the constraints that could not be reconciled.
Reproduce a deterministic conflict with two local packages, so the report is small enough to read:
mkdir -p /tmp/pipc/{a,b} && cd /tmp/pipc
cat > a/setup.py <<'EOF'
from setuptools import setup
setup(name="pkg-a", version="1.0", install_requires=["six==1.15.0"])
EOF
cat > b/setup.py <<'EOF'
from setuptools import setup
setup(name="pkg-b", version="1.0", install_requires=["six==1.16.0"])
EOF
python3 -m venv .venv && . .venv/bin/activate
pip install -q ./a ./bpip reports pkg-a 1.0 depends on six==1.15.0 and pkg-b 1.0 depends on six==1.16.0, which is the same structure as any real conflict, only with a single line each.
Useful flags while diagnosing, all of which avoid changing the environment:
pip install --dry-run --report report.json -r requirements.txt
pip install --dry-run -v "package" 2>&1 | grep -E "Collecting|Downloading|Would install"
python3 -m pip debug --verbose | head -20 # tags, platform, python version# is a stale constraint file or an extra the cause?
pip config list
pip install --no-cache-dir -r requirements.txt
pip install -r requirements.txt --upgrade-strategy only-if-neededKey Comparison Table
| Conflict shape | Example | Fix |
|---|---|---|
| direct pin vs dependency range | pydantic==2.9.2 and pydantic>=2.10 | loosen the direct pin |
| two transitive ranges with no overlap | urllib3<2 and urllib3>=2.2 | upgrade the older dependent |
| marker overlap | numpy<2 on py3.9, numpy>=2 for one extra | split extras, or pin per python version |
requires-python | package needs >=3.10, environment is 3.9 | new environment or older package |
| constraints file drift | constraints.txt pins an old version | regenerate the constraints |
| platform-only wheels | no wheel for this platform | install build tools, or another version |
| extra activated by a dependent | pkg[async] pulls a strict pin | install the extra explicitly |
| Workaround | What it does | Why it is not a fix |
|---|---|---|
--no-deps | skips dependency resolution | leaves an unsatisfied graph that breaks at runtime |
--force-reinstall | reinstalls, ignores conflict | does not change the constraints |
| older pip | changes resolver behaviour | new resolver reports real conflicts |
--ignore-installed | bypasses the installed set | duplicates modules, hides the cause |
| pinning both sides tighter | adds another constraint | makes the conflict permanent |
Practical Edge Cases, Error Fixes & Deep Dive Code Examples
1. The user requested is the line to read first
pip repeats the constraint chain, and the first line is your own requirement while the following lines are what depends on it. If your pin is the tighter side, loosen it; if a dependency's range is the tighter side, upgrade that dependency:
pip index versions pydantic 2>/dev/null | head -3
pip download "fastapi==0.112.0" --no-deps -d /tmp/whl >/dev/null && \
unzip -p /tmp/whl/*.whl '*/METADATA' | grep -i "Requires-Dist.*pydantic"Reading the metadata of the dependent package answers "what range does it accept" without guessing from the error text.
2. Extras that activate different ranges
An extra can pull in a variant of a dependency with its own pins, and the same top-level package then appears twice in the graph. Removing an unused extra is often the whole fix:
[project]
dependencies = [
"sqlalchemy[asyncio]>=2.0.30",
"asyncpg>=0.29",
]If the extra is needed, install the transitively pinned version explicitly so the resolver has one target instead of two ranges.
3. Python version markers
A requirements.txt shared between a 3.9 CI job and a 3.12 laptop can encode contradictory markers. pip evaluates markers for the current interpreter, so the error appears on one machine only:
pydantic>=2.10; python_version >= "3.10"
pydantic<2; python_version < "3.10"The conflict is real for an environment where both markers are true, which happens if one line was written with the wrong operator. python -m pip install --dry-run -r requirements.txt on the exact interpreter used in CI is the reliable test.
4. Constraints files that outlive their packages
A constraints.txt generated a year ago pins versions that a new dependency cannot use. The error names your own file only as -c constraints.txt, which is easy to miss:
pip install -r requirements.txt -c constraints.txt --dry-run -v 2>&1 | grep constraints
grep -n "pydantic" constraints.txtRegenerate constraints from a resolved environment instead of maintaining them by hand, or drop them for the dependency that moved.
5. Reproducible resolution with a lock
The lasting fix for a service is a lockfile whose resolution happened once, on purpose. pip-tools and uv both produce one, and CI installs from it rather than re-resolving:
pip install pip-tools
pip-compile --generate-hashes -o requirements.lock pyproject.toml
pip install --require-hashes -r requirements.lock# uv, if already in use
uv pip compile pyproject.toml -o requirements.lock
uv pip sync requirements.lockA lock turns "resolution impossible" into a build-time event rather than a deploy-time one, and it makes the conflict visible in the pull request that introduced it.
6. When the resolver is right and the requirement is wrong
Sometimes the honest answer is that the two features cannot coexist in one environment. Splitting them into two services, or two optional extras, is a real solution; forcing both with --no-deps postpones a ModuleNotFoundError or an AttributeError to production traffic:
pip install -r requirements-core.txt
pip install -r requirements-ml.txt # separate environment, separate imageCommon Compilation/Runtime Mistakes & Version Gotchas
- Reading only the first error line. The conflict chain at the end is the actual evidence.
- Reaching for
--no-deps. It installs an unsatisfiable graph and moves the failure to import time. - Upgrading pip to "fix" resolution. Newer pip finds the same conflict and explains it better.
- Pinning both sides tighter. Two exact pins with no overlap can never resolve.
- Ignoring
requires-python. A package that needs 3.10 cannot install on a 3.9 runner. - Sharing one
requirements.txtacross Python versions without markers. The markers must be correct. - Keeping an old constraints file. It pins the past and blocks the present.
- Resolving on every deploy. A lockfile makes resolution a reviewed event.
When the report is long, extract the constraint lines with the regex tester, and compare the resolved and requested dependency sets with the text diff tool before editing anything.
Reference: pip's dependency resolution, the pip user guide, and the version specifiers specification.
Official references
primary documentationThe Python documentation that defines the behaviour this guide explains.
Try matching browser tools
All toolsSmall utilities that fit Python work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related Python guides
All Python guidesasyncpg DuplicatePreparedStatement on PgBouncer and Supabase
asyncpg caches prepared statements per connection while a transaction pooler rotates connections underneath it. The cache setting, pool sizing and retry that fix it.
Python Tabulate: Markdown Grid Headers and Alignment
Use Python's tabulate library to format Markdown tables, set custom headers, and control column alignment with pipe and grid formats.
Using pytest.mark.parametrize for Parameterized Tests in Python
Learn how to use pytest.mark.parametrize to write parameterized tests in Python. Covers syntax, multiple arguments, fixtures, custom IDs, class/module-level use, and common pitfalls.
Django select_related and prefetch_related: Fix N+1 Queries
Learn how to eliminate N+1 queries in Django with select_related and prefetch_related, including practical examples, when to use each, and common pitfalls.
More in Python
All Python guidesThe guides filed next to this one in Python, in library order.