Fix: Poetry Dependency Conflict (SolverProblemError / No Solution Found)
Quick Answer
How to fix Poetry dependency resolution errors — SolverProblemError when adding packages, conflicting version constraints, how to diagnose dependency trees, and workarounds for incompatible packages.
The Error
Running poetry add some-package or poetry install fails with:
SolverProblemError
Because myproject depends on package-a (^2.0) and package-b (^3.0)
and package-b (3.0.0) depends on package-a (^1.0),
package-a cannot be both >=2.0,<3.0 and >=1.0,<2.0.
So, because myproject depends on package-a (^2.0), version solving failed.Or when adding a new package:
Because requests (2.31.0) depends on urllib3 (<3,>=1.21.1)
and your project depends on urllib3 (^2.0), requests is forbidden.Or after pulling a project:
poetry install
...
PackageNotFound: Package pandas (1.5.0) not found.Why This Happens
Poetry uses a SAT solver to find a combination of package versions that satisfies all constraints simultaneously. A SolverProblemError means no such combination exists:
- Direct conflict — package A requires
requests>=2.28and package B requiresrequests<2.28. Both cannot be true. - Transitive conflict — you don’t directly depend on the conflicting package, but two of your dependencies pull in incompatible versions of a shared sub-dependency.
- Overly strict constraints — your
pyproject.tomlpins a version too tightly (e.g.,urllib3 = "1.26.0"instead ofurllib3 = ">=1.26.0"). - Python version incompatibility — a package you are trying to install only supports Python 3.10+, but your project targets Python 3.9.
- Lock file out of sync — the
poetry.lockreferences a package version that no longer exists on PyPI (yanked release).
Fix 1: Diagnose the Conflict
Before fixing, understand exactly what is conflicting:
# Show the full dependency tree
poetry show --tree
# Show why a specific package is installed and what requires it
poetry show requests
# Output shows: required by, version installed, dependencies
# Check what version constraints are on a package
poetry show --tree | grep -A5 "urllib3"
# See all packages and their versions
poetry show
# Check for outdated packages
poetry show --outdatedRead the error message carefully. Poetry’s error messages are detailed — they tell you exactly which packages conflict and why:
Because httpx (0.24.0) depends on httpcore (>=0.17.0,<0.18.0)
and aiohttp (3.8.5) depends on httpcore (>=0.16.0,<0.17.0),
httpx and aiohttp are incompatible.This tells you httpx and aiohttp cannot coexist in their current versions because they require different httpcore ranges.
Fix 2: Relax Version Constraints
Overly strict pinning in pyproject.toml is the most common fixable cause:
# pyproject.toml — before (too strict)
[tool.poetry.dependencies]
python = "^3.9"
requests = "2.28.0" # Exact pin — inflexible
urllib3 = "^1.26" # May conflict with requests' requirements
# After — relaxed constraints
[tool.poetry.dependencies]
python = "^3.9"
requests = "^2.28" # Allow any 2.28.x or higher (within major)
urllib3 = ">=1.26,<3" # Allow 1.x or 2.xCommon constraint syntax:
package = "^2.0" # >=2.0.0, <3.0.0 (caret — most common)
package = "~2.1" # >=2.1.0, <2.2.0 (tilde — patch-level)
package = ">=2.0" # Any version 2.0 or higher
package = ">=2.0,<3" # Range
package = "*" # Any versionAfter relaxing constraints:
poetry update package-name # Re-resolve with new constraintsFix 3: Update the Conflicting Package
Often the conflict is because you are requesting a new package that requires a newer version of a shared dependency than your existing packages allow:
# Update a specific package that is causing the conflict
poetry update urllib3
# Update all packages to their latest compatible versions
poetry update
# Add a package and allow Poetry to upgrade dependencies
poetry add new-package --no-interactionCheck if a newer version of the conflicting package resolves it:
# See available versions of a package
poetry search some-package
# Or check PyPI directly
pip index versions some-packageFix 4: Use Dependency Groups to Isolate Conflicts
If the conflict is between development and production dependencies, separate them into groups:
# pyproject.toml
[tool.poetry.dependencies]
python = "^3.11"
fastapi = "^0.104"
sqlalchemy = "^2.0"
[tool.poetry.group.dev.dependencies]
pytest = "^7.4"
black = "^23.0"
# Dev tools with conflicting deps go here — isolated from production
[tool.poetry.group.test.dependencies]
pytest-asyncio = "^0.21"
httpx = "^0.25" # May conflict with aiohttp in dev group — separate group isolates it# Install only production dependencies (no dev groups)
poetry install --only main
# Install with a specific group
poetry install --with test
# Install without a specific group
poetry install --without devFix 5: Override a Transitive Dependency
When two packages require incompatible versions of a shared sub-dependency and you cannot upgrade either package, use overrides to force a specific version:
# pyproject.toml — force a specific version of a transitive dependency
[tool.poetry.dependencies]
python = "^3.11"
package-a = "^2.0"
package-b = "^3.0"
# Force urllib3 to a version compatible with both package-a and package-b
[tool.poetry.dependencies.urllib3]
version = "^1.26"
python = "*"For more complex overrides — use poetry source or direct path dependencies:
# Pin a transitive dep by adding it directly with a compatible range
[tool.poetry.dependencies]
urllib3 = ">=1.26.0,<3" # Explicitly manage the transitive deppoetry lock --no-update # Re-lock without upgrading other packages
poetry installFix 6: Use pip as a Fallback for Truly Incompatible Packages
When Poetry’s solver cannot find a solution but you know the packages actually work together at runtime, install one of them with pip directly inside the virtual environment:
# Activate the Poetry virtual environment
poetry shell
# Install the conflicting package with pip (bypasses Poetry's solver)
pip install some-problematic-package==1.2.3
# Return to normal Poetry workflow for everything else
exitWarning: Packages installed with
pipinside a Poetry environment are not tracked inpyproject.tomlorpoetry.lock. This is a last resort — document it clearly and investigate a proper fix. The dependency may break on the nextpoetry install.
Alternative — use a virtual environment directly:
python -m venv .venv
source .venv/bin/activate
pip install package-a package-b # No solver — just installsFix 7: Recreate the Lock File
If poetry.lock is out of sync or corrupted:
# Delete and regenerate the lock file
rm poetry.lock
poetry lock
# Then install
poetry installIf a specific package version was yanked from PyPI:
# Find what version is in the lock file
grep -A5 "name = \"pandas\"" poetry.lock
# Force update to a non-yanked version
poetry add pandas@^2.0 # Specify a valid version range
# Or update just that package
poetry update pandasMigrate from older Poetry versions (1.x to 1.5+/2.x):
# Poetry 2.x changed pyproject.toml format — update the project
poetry self update
# After updating Poetry, re-lock
rm poetry.lock
poetry lock
poetry installStill Not Working?
Try --verbose to see the full solver trace:
poetry add some-package -vvv 2>&1 | head -100Check if the conflict is in dev dependencies only. If production works but dev doesn’t, move the conflicting tool to an isolated group.
Check Python version compatibility. Some packages drop support for older Python versions in their latest releases:
# Require Python 3.11+ if needed packages require it
[tool.poetry.dependencies]
python = "^3.11"# Check which Python versions a package supports
pip index versions some-package # Check available versions
pip show some-package # After install — shows requires-pythonUse poetry env info to verify which Python and virtual environment Poetry is using:
poetry env info
# Shows Python version, virtual env path, and active status
poetry env list # List all environments for this project
poetry env use python3.11 # Switch Python versionFor related Python environment and package issues, see Fix: pip No Matching Distribution Found and Fix: Python ModuleNotFoundError (venv).
Solo developer based in Japan. Every solution is cross-referenced with official documentation and tested before publishing.
Was this article helpful?
Related Articles
Fix: Python venv Using Wrong Python Version
How to fix Python virtual environments using the wrong Python version — venv picking system Python instead of pyenv, specifying the interpreter path, and verifying the active environment.
Fix: Flask Route Returns 404 Not Found
How to fix Flask routes returning 404 — trailing slash redirect, Blueprint prefix issues, route not registered, debug mode, and common URL rule mistakes.
Fix: Git Keeps Asking for Username and Password
How to fix Git repeatedly prompting for credentials — credential helper not configured, HTTPS vs SSH, expired tokens, macOS keychain issues, and setting up a Personal Access Token.
Fix: pandas merge() Key Error and Duplicate Columns (_x, _y)
How to fix pandas merge and join errors — KeyError on merge key, duplicate _x/_y columns, unexpected row counts, suffixes, and how to validate merge results.