Installer: verify the interpreter version the py launcher resolves to - #131
Merged
Conversation
The Windows installers trusted the py launcher blindly: when "py -3.13" or "py -3.12" exited successfully, the resolved sys.executable was used for "uv sync --python" without checking its actual version. A stale or wrong launcher registration (e.g. a registry entry left behind by a Python upgrade or uninstall) can resolve such a tag to an old install like Python 3.10, which then fails the sync with: error: The requested interpreter resolved to Python 3.10.11, which is incompatible with the project's Python requirement: '>=3.12, <3.14' Verify the major.minor version of the interpreter the launcher returns, mirroring the check the PATH fallback already does. On mismatch the discovery now falls through to the PATH fallback and finally to the portable uv-managed Python 3.12, so the install self-heals instead of aborting.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Windows CPU and CUDA installer scripts now compute and compare the resolved interpreter’s major.minor version with the requested ChangesWindows Python validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a machine whose
pylauncher resolves the-3.13/-3.12tag to a wrong interpreter (e.g. a stale registry registration left behind by a Python upgrade or uninstall), the Windows installers hand that interpreter straight touv sync --python, which then aborts:This happened after
uv lockhad already succeeded, so the run failed at the very last step.Root cause
The py-launcher discovery block only checked the launcher's exit code, never the version of the interpreter it actually returned. The PATH fallback right below it already verifies
sys.version_infobefore accepting a candidate — the launcher block was the one discovery path without that check, and it is also the only path that can produce a full interpreter path, which matches the failure output above.Fix
Verify the
major.minorversion of the interpreter the launcher resolves (same check the PATH fallback uses). On mismatch, discovery falls through to the PATH fallback and finally to the portable uv-managed Python 3.12, so the installer now self-heals on such machines instead of aborting.Applied to both
install/CPU/windows_cpu.batandinstall/CUDA/windows_cuda_gpu.bat(identical block).Testing
Summary by CodeRabbit