Repository navigation
Windows installer: prefer uv-managed Python over global winget installs - #7825
danielhanchen merged 12 commits into
Conversation
|
FYI, my python (and also UV) istalled via scoop and live under |
… as fallback Re-implements unslothai#7802 on current main: when no Python 3.11-3.13 is found on a non-ARM64 host, install.ps1 now asks uv for a managed interpreter (uv python install --no-bin --no-registry) once uv is set up, instead of installing Python system-wide through winget / python.org. If uv cannot provide one (offline, python-downloads disabled, skipped patch), the previous winget / python.org install runs as before. Windows on ARM keeps the system install.
|
Review record for #7825, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#447. Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found. Round 1: reviewed mirror
|
Fixes #7802.
On a Windows host with no Python 3.11 to 3.13,
install.ps1installed CPython system-wide (winget, then python.org) and only then used uv to build the Studio venv. uv can provide the interpreter itself, so the system install is unnecessary on most machines.Change
Resolve-UvManagedPythonrunsuv python install --no-bin --no-registry <minor>anduv python find --system --managed-python <minor>, and the venv is created from that interpreter path.--no-bin/--no-registry: only uv's own Python store changes; nothing is added to PATH,~/.local/bin, or the py launcher registry.--systemonfind: without it uv answers with an active venv's python.>=3.13,<3.14,!=3.13.8, asinstall.shdoes), so a cached healthy patch is reused offline; the full version is re-checked under-Sbefore use.python-downloads = never, policy), the previous winget / python.org install runs unchanged as a fallback, so no machine loses its install path.Tests
tests/python/test_windows_uv_managed_python.pyrunsResolve-UvManagedPythonunder pwsh / Windows PowerShell against a fake uv (success, failed install, nothing found, skipped patch) and pins the ordering: defer, uv setup, uv resolution, system fallback, venv creation. The existing Windows Python selection suites (test_windows_on_arm_python_arch.py,test_windows_python_313_8_screen.py,test_windows_python_venv_hardening.py,test_windows_arm64_python_choice.py) still pass. The function was also run against a real uv 0.10.7 with an active venv: it returned the managed interpreter,uv venv --python <path>built from it, and no executable was added to~/.local/bin.