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

[windows] python 3.13t detection overwrites python 3.13 detection #313

Closed
ddelange opened this issue Jan 10, 2025 · 5 comments
Closed

[windows] python 3.13t detection overwrites python 3.13 detection #313

ddelange opened this issue Jan 10, 2025 · 5 comments

Comments

@ddelange
Copy link

ddelange commented Jan 10, 2025

Window's python version detection has a bug

I can confirm from the CI run:

Directory: D:\a\blake3-py\blake3-py\dist

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---            1/3/2025  2:35 PM         208203 blake3-1.0.1-cp310-cp310-win_amd64.whl
-a---            1/3/2025  2:36 PM         207621 blake3-1.0.1-cp311-cp311-win_amd64.whl
-a---            1/3/2025  2:36 PM         207582 blake3-1.0.1-cp312-cp312-win_amd64.whl
-a---            1/3/2025  2:36 PM         206186 blake3-1.0.1-cp313-cp313t-win_amd64.whl
-a---            1/3/2025  2:35 PM         208497 blake3-1.0.1-cp38-cp38-win_amd64.whl
-a---            1/3/2025  2:35 PM         208619 blake3-1.0.1-cp39-cp39-win_amd64.whl

that a regular 3.13 wheel is missing for windows

looks like a bug in maturin action:

🐍 Found 
CPython 3.8 at C:\hostedtoolcache\windows\Python\3.8.10\x64\python.exe, 
CPython 3.9 at C:\hostedtoolcache\windows\Python\3.9.13\x64\python.exe, 
CPython 3.10 at C:\hostedtoolcache\windows\Python\3.10.11\x64\python.exe, 
CPython 3.11 at C:\hostedtoolcache\windows\Python\3.11.9\x64\python.exe, 
CPython 3.12 at C:\hostedtoolcache\windows\Python\3.12.8\x64\python.exe, 
CPython 3.13t at C:\hostedtoolcache\windows\Python\3.13.1\x64-freethreaded\python.exe, 
CPython 3.13t at C:\hostedtoolcache\windows\Python\3.13.1\x64-freethreaded\python3.13t.exe

cc @davidhewitt the action is not picking up the regular 3.13 which we setup-python'd just before 3.13t. can you confirm this is maturin-action? it seems like an edge case for windows only (both win32 and win_amd64), linux and macos are fine:

🐍 Found CPython 3.8, CPython 3.9, CPython 3.10, CPython 3.11, CPython 3.12, CPython 3.13, CPython 3.13t

...

drwxr-xr-x  18 runner  staff     576 Jan  3 14:32 ..
-rw-r--r--   1 runner  staff  311529 Jan  3 14:32 blake3-1.0.1-cp38-cp38-macosx_11_0_arm64.whl
-rw-r--r--   1 runner  staff  311523 Jan  3 14:32 blake3-1.0.1-cp39-cp39-macosx_11_0_arm64.whl
-rw-r--r--   1 runner  staff  311647 Jan  3 14:33 blake3-1.0.1-cp310-cp310-macosx_11_0_arm64.whl
-rw-r--r--   1 runner  staff  311392 Jan  3 14:33 blake3-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
-rw-r--r--   1 runner  staff  308960 Jan  3 14:33 blake3-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
-rw-r--r--   1 runner  staff  308854 Jan  3 14:33 blake3-1.0.1-cp313-cp313-macosx_11_0_arm64.whl
-rw-r--r--   1 runner  staff  307093 Jan  3 14:33 blake3-1.0.1-cp313-cp313t-macosx_11_0_arm64.whl

edit: setup-python'ing 3.13t before 3.13 does not help for win_amd64, but does help for win32:

🐍 Found 
CPython 3.8 at C:\hostedtoolcache\windows\Python\3.8.10\x86\python.exe, 
CPython 3.9 at C:\hostedtoolcache\windows\Python\3.9.13\x86\python.exe, 
CPython 3.10 at C:\hostedtoolcache\windows\Python\3.10.11\x86\python.exe, 
CPython 3.11 at C:\hostedtoolcache\windows\Python\3.11.9\x86\python.exe, 
CPython 3.12 at C:\hostedtoolcache\windows\Python\3.12.8\x86\python.exe, 
CPython 3.13 at C:\hostedtoolcache\windows\Python\3.13.1\x86\python.exe, 
CPython 3.13t at C:\hostedtoolcache\windows\Python\3.13.1\x86-freethreaded\python3.13t.exe

Originally posted by @ddelange in oconnor663/blake3-py#52 (comment)

@ddelange
Copy link
Author

@messense
Copy link
Member

Not sure what we can do here in maturin-action, it simply add Python versions in tool cache to $PATH so that maturin can find them.

maturin-action/src/index.ts

Lines 802 to 821 in e9b5cc0

async function addToolCachePythonVersionsToPath(): Promise<void> {
const allPythonVersions = tc.findAllVersions('Python')
for (const ver of allPythonVersions) {
const installDir = tc.find('Python', ver)
if (installDir) {
core.info(`Python version ${ver} was found in the local cache`)
core.addPath(installDir)
core.addPath(path.join(installDir, 'bin'))
}
}
const allPyPyVersions = tc.findAllVersions('PyPy')
for (const ver of allPyPyVersions) {
const installDir = tc.find('PyPy', ver)
if (installDir) {
core.info(`Python version ${ver} was found in the local cache`)
core.addPath(installDir)
core.addPath(path.join(installDir, 'bin'))
}
}
}

And findAllVersion is defined here:

https://github.com/actions/toolkit/blob/5e8c25d1f5d92a53f2438de763f92d4809dd666f/packages/tool-cache/src/tool-cache.ts#L544-L563

@messense
Copy link
Member

Closing in favor of Quansight-Labs/setup-python#5

@messense messense closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2025
@messense
Copy link
Member

BTW, it should be easy to workaround, just have two steps of maturin-action run, 1 for regular CPythons, 1 for python3.13t, and setup python3.13t in between them.

@ddelange
Copy link
Author

Thanks @messense, your suggested workaround works fine: oconnor663/blake3-py#54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants