Skip to content

Fix: Poetry Dependency Conflict (SolverProblemError / No Solution Found)

FixDevs ·

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.28 and package B requires requests<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.toml pins a version too tightly (e.g., urllib3 = "1.26.0" instead of urllib3 = ">=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.lock references 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 --outdated

Read 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.x

Common 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 version

After relaxing constraints:

poetry update package-name  # Re-resolve with new constraints

Fix 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-interaction

Check 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-package

Fix 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 dev

Fix 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 dep
poetry lock --no-update  # Re-lock without upgrading other packages
poetry install

Fix 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
exit

Warning: Packages installed with pip inside a Poetry environment are not tracked in pyproject.toml or poetry.lock. This is a last resort — document it clearly and investigate a proper fix. The dependency may break on the next poetry install.

Alternative — use a virtual environment directly:

python -m venv .venv
source .venv/bin/activate
pip install package-a package-b  # No solver — just installs

Fix 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 install

If 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 pandas

Migrate 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 install

Still Not Working?

Try --verbose to see the full solver trace:

poetry add some-package -vvv 2>&1 | head -100

Check 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-python

Use 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 version

For related Python environment and package issues, see Fix: pip No Matching Distribution Found and Fix: Python ModuleNotFoundError (venv).

F

FixDevs

Solo developer based in Japan. Every solution is cross-referenced with official documentation and tested before publishing.

Was this article helpful?

Related Articles