When a venv from a managed toolchain exists, uv ignores --python-preference only-system.
To reproduce, take a system without python3.11 on path:
[project]
name = "foo"
version = "1"
requires-python = "==3.11.*"
dependencies = [
"tqdm",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
Create a managed venv, then sync again with --python-preference only-system. The venv is still managed python, which we can confirm by trying to recreate the venv:
$ uv sync
Using Python 3.11.9 interpreter at: /home/konsti/.local/share/uv/python/cpython-3.11.9-linux-x86_64-gnu/bin/python3
Creating virtualenv at: .venv
Resolved 3 packages in 5ms
Built foo @ file:///home/konsti/projects/foo
Prepared 1 package in 120ms
Installed 2 packages in 1ms
+ foo==1 (from file:///home/konsti/projects/foo)
+ tqdm==4.66.4
$ uv sync --python-preference only-system
Resolved 3 packages in 4ms
Audited 2 packages in 0.10ms
$ rm -r .venv
$ uv sync --python-preference only-system
error: No interpreter found for Python >=3.11, <3.12 in system path