#15391Package resolution error based on pyproject.tomls requires-python setting

uhurusurfauhurusurfa
opened 22 days ago
Author

Summary

I have a project that uses Django and currently Django has an officially supported version that support Python 3.9. The latest versions of Django require Python >= 3.10

Therefore I have set this is my pyproject.toml: requires-python = ">=3.9"

If I use a Django version of 4.2.* then all is good (even if I pin the python version to 3.9) and the uv sync command works as expected since it is possible to resolve all dependencies and produce a valid venv.

If I then change the django version to >=5 I get this:

% uv add django~=5.0 × No solution found when resolving dependencies for split (markers: python_full_version == '3.9.*'): ╰─▶ Because the requested Python version (>=3.9) does not satisfy Python>=3.10 and all of: django>=5.0,<=5.0.4 django>=5.0.6 depend on Python>=3.10, we can conclude that all of: django>=5.0,<=5.0.4 django>=5.0.6 cannot be used. And because only the following versions of django are available: django<=5.0.14 django>=5.1,<=5.1.11 django>=5.2 and django==5.0.5 was yanked (reason: Release files have Windows end-of-line characters and are missing executable bits), we can conclude that django>=5.0 cannot be used. And because your project depends on django>=5.0 and your project requires django-helpdesk[teams], we can conclude that your project's requirements are unsatisfiable. hint: Pre-releases are available for `django` in the requested range (e.g., 5.2rc1), but pre-releases weren't enabled (try: `--prerelease=allow`) hint: The `requires-python` value (>=3.9) includes Python versions that are not supported by your dependencies (e.g., all of: django>=5.0,<=5.0.4 django>=5.0.6 only supports >=3.10). Consider using a more restrictive `requires-python` value (like >=3.10). hint: While the active Python version is 3.13, the resolution failed for other Python versions supported by your project. Consider limiting your project's supported Python versions using `requires-python`. help: If you want to add the package regardless of the failed resolution, provide the `--frozen` flag to skip locking and syncing.

Even if I add the --frozen option, then when I run sync it still blows up with the same message.

I have tried various options to get around this to no avail and I cannot run my test matrix that test the valid combinations of usable versions of Python and Django.

The only solution appears to be to cater for the versions of Python that are supported only by the very latest version of Django that I want to test.

It is quite common in Django projects to provide a matrix of supported Python and Django versions and this issue is a signifcant problem for using uv in CI testing.

Am I missing something here?

Platform

linux

Version

uv 0.8.12 (36151df0e 2025-08-18)

Python version

Python 3.13.2