Skip to content

uv lock --refresh crashes on local uv sources with mixed python versions #18199

@PerchunPak

Description

@PerchunPak

Summary

If the root repository has requires-python = ">=3.10", but its child has requires-python = ">=3.12", uv lock --refresh crashes on 3.10 but works on 3.14.

This use case is mentioned in the docs at the bottom here (before the note block)

# pyproject.toml
[project]
name = "hello-world"
version = "0.1.0"

requires-python = ">=3.10"
dependencies = [
  "docs; python_version >= '3.12'"
]

[tool.uv.sources]
docs = { path = "docs" }

[build-system]
requires = ["uv_build>=0.10.4,<0.11.0"]
build-backend = "uv_build"
# docs/pyproject.toml
[project]
name = "docs"
version = "0.1.0"

requires-python = ">=3.12"
dependencies = ["Sphinx~=9.1.0"]

[build-system]
requires = ["uv_build>=0.10.4,<0.11.0"]
build-backend = "uv_build"
> echo 3.10 > .python-version
> uv lock --refresh
  × No solution found when resolving dependencies for split (markers: python_full_version >= '3.12'):
  ╰─▶ Because only docs{python_full_version >= '3.12'}==0.1.0 is available and the current Python version (3.10.19) does not satisfy Python>=3.12, we can conclude that all versions of
      docs{python_full_version >= '3.12'} cannot be used.
      And because your project depends on docs{python_full_version >= '3.12'}, we can conclude that your project's requirements are unsatisfiable.

      hint: While the active Python version is 3.10, the resolution failed for other Python versions supported by your project. Consider limiting your project's supported Python versions
      using `requires-python`.
> echo 3.14 > .python-version
> uv lock --refresh
Using CPython 3.14.2
Resolved 25 packages in 80ms

If you replace docs; python_version >= '3.12' with Sphinx~=9.1.0; python_version >= '3.12', everything works as expected

This was also reproduced in GitHub actions on Linux, MacOS, and Windows
https://github.com/py-mine/mcstatus/actions/runs/22424511522?pr=1118

Platform

Linux 6.18.9-zen1 x86_64 GNU/Linux (NixOS)

Version

uv 0.10.6

Python version

3.10.19 and 3.14.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions