Skip to content

/errors/poetry/supported-python-range-not-compatible

Poetry: The current project's supported Python range is not compatible with some of the required packages

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
tool
Poetry
exit code
1
versions
Poetry 2.x
os
any

The current project's supported Python range (>=3.8) is not compatible with some of the required packages Python requirement means Poetry resolves dependencies for every Python version your project claims to support, and at least one dependency does not support all of them. Poetry lists the package and its range (numpy requires Python >=3.10) and suggests a fix. Raise requires-python to that range, or limit the dependency to the Python versions it supports with a python marker.

Reproduce it

bash
cat > pyproject.toml <<'EOF'
[project]
name = "demo"
version = "0.1.0"
requires-python = ">=3.8"
dependencies = ["numpy==2.1.0"]

[tool.poetry]
package-mode = false
EOF
uvx -q poetry@2.5.1 config virtualenvs.in-project true --local
uvx -q poetry@2.5.1 lock

Output · exit 1

Creating virtualenv demo in /tmp/work/.venv
Updating dependencies
Resolving dependencies...

The current project's supported Python range (>=3.8) is not compatible with some of the required packages Python requirement:
  - numpy requires Python >=3.10, so it will not be installable for Python >=3.8,<3.10

Because demo depends on numpy (2.1.0) which requires Python >=3.10, version solving failed.

  * Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties

    For numpy, a possible solution would be to set the `python` property to ">=3.10"

    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
    https://python-poetry.org/docs/dependency-specification/#using-environment-markers

The resolution is done for Python 3.8 and 3.9 too, even if you run Python 3.13 locally, because the lockfile must work for the whole declared range.

Fix

Narrow the range to what the dependencies support:

bash
cat > pyproject.toml <<'EOF'
[project]
name = "demo"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = ["numpy==2.1.0"]

[tool.poetry]
package-mode = false
EOF
uvx -q poetry@2.5.1 config virtualenvs.in-project true --local
uvx -q poetry@2.5.1 lock -q && echo "locked"

Output

locked

If the project must keep supporting older Python versions, install the dependency only where it works:

pyproject.toml
[tool.poetry.dependencies]
numpy = { version = "2.1.0", python = ">=3.10" }

A library published to PyPI should keep the widest range that works; an application can usually declare only the versions it is deployed on.

Sources