Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed uv can't create .venv for cpython-x86 on Windows #2707

Merged
merged 4 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,32 @@ jobs:
- name: "Validate global Python install"
run: py -3.10 ./scripts/check_system_python.py --uv ./uv.exe

system-test-windows-x86-python-310:
needs: build-binary-windows
name: "check system | python3.10 on windows x86"
runs-on: windows-latest
env:
# Avoid debug build stack overflows.
UV_STACK_SIZE: 2000000 # 2 megabyte, double the default on windows
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: "x86"

- name: "Download binary"
uses: actions/download-artifact@v4
with:
name: uv-windows-${{ github.sha }}

- name: "Print Python path"
run: echo $(which python)

- name: "Validate global Python install"
run: python ./scripts/check_system_python.py --uv ./uv.exe

system-test-windows-python-313:
needs: build-binary-windows
name: "check system | python3.13 on windows"
Expand Down
12 changes: 11 additions & 1 deletion crates/uv-interpreter/python/get_interpreter_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,17 @@ def get_operating_system_and_architecture():
"""
# https://github.com/pypa/packaging/blob/cc938f984bbbe43c5734b9656c9837ab3a28191f/src/packaging/_musllinux.py#L84
# Note that this is not `os.name`.
[operating_system, version_arch] = sysconfig.get_platform().split("-", 1)
# https://docs.python.org/3/library/sysconfig.html#sysconfig.get_platform
# windows x86 will return win32
platform_info = sysconfig.get_platform().split("-", 1)
if len(platform_info) == 1:
if platform_info[0] == "win32":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have some context on why 32-bit windows is the only platform where that happens, and can you add a comment above the line explaining the special case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.python.org/3/library/sysconfig.html#sysconfig.get_platform
According to the documentation, sysconfig.get_platform () returns "win32" when using the x86 version of Windows. This is a known issue. I'll add the documentation to the notes later.

operating_system, version_arch = "win", "i386"
else:
# unknown_operating_system will flow to the final error print
operating_system, version_arch = platform_info[0], ""
else:
[operating_system, version_arch] = platform_info
if "-" in version_arch:
# Ex: macosx-11.2-arm64
version, architecture = version_arch.rsplit("-", 1)
Expand Down
Loading