/errors/poetry/supported-python-range-not-compatible
Poetry: The current project's supported Python range is not compatible with some of the required packages
- 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
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 lockOutput · 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-markersThe 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:
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:
[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
- python-poetry.orgpython-poetry.org/docs/dependency-specification/#python-restricted-dependencies
- python-poetry.orgpython-poetry.org/docs/pyproject/#requires-python
- python-poetry.orgpython-poetry.org/docs/faq/#why-is-poetry-telling-me-that-the-current-projects-supported-python-range-is-not-compatible-with-one-or-more-packages-python-requirements