Skip to content

fix(ci): pin Python discovery to the intended interpreter#6105

Open
henryiii wants to merge 2 commits into
pybind:masterfrom
henryiii:henryiii/fix/ci-freethreaded
Open

fix(ci): pin Python discovery to the intended interpreter#6105
henryiii wants to merge 2 commits into
pybind:masterfrom
henryiii:henryiii/fix/ci-freethreaded

Conversation

@henryiii

Copy link
Copy Markdown
Collaborator

🤖 AI text below 🤖

Description

CI has been red since the manylinux/musllinux images added Python 3.15 and dropped 3.13t, and the same runner refresh broke the free-threaded jobs on macOS and Windows:

  • In the manylinux jobs, uv creates the requested venv, but Python_ROOT_DIR is only a hint: FindPython's version scan tries 3.15 first and finds /usr/local/bin/python3.15 on PATH before considering the venv's older interpreter. All four jobs then built against 3.15 and failed at the pytest step (No module named pytest).
  • In the standard macOS/Windows 3.14t jobs, FindPython picked a system GIL 3.14 (e.g. Homebrew's framework build) instead of setup-python's free-threaded interpreter.

Fixes:

  • CMakeLists.txt: when the venv machinery sets Python_ROOT_DIR, also pin Python_EXECUTABLE to the venv's interpreter, making discovery exact instead of heuristic.
  • reusable-standard.yml: pass setup-python's interpreter to CMake as -DPYTHON_EXECUTABLE (works in both old and new FindPython modes).
  • ci.yml: drop the 3.13t manylinux rows; the images no longer ship 3.13t, and 3.14t rows already exist.

Suggested changelog entry:

henryiii added 2 commits July 23, 2026 01:47
The manylinux/musllinux images added Python 3.15 and dropped 3.13t;
FindPython's version scan then picked /usr/local/bin/python3.15 over
the uv-created venv (Python_ROOT_DIR is only a hint). Similarly, the
macOS and Windows 3.14t jobs picked a system 3.14 over setup-python's
free-threaded interpreter. Pin the interpreter explicitly in both
places, and drop the 3.13t manylinux jobs.

Assisted-by: ClaudeCode:claude-fable-5
@rwgk

rwgk commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

@rwgk rwgk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested revised title:

fix(ci): use the intended Python interpreter for CMake discovery

All suggestions aim to avoid using the term "pin", it doesn't seem quite fitting.

Thanks for taking care of this!

Comment on lines +71 to +72
# FindPython's version scan can pick a different interpreter (e.g.
# Homebrew's 3.14 instead of setup-python's 3.14t), so pin it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# FindPython's version scan can pick a different interpreter (e.g.
# Homebrew's 3.14 instead of setup-python's 3.14t), so pin it.
# Pass setup-python's resolved interpreter path to CMake so FindPython
# does not select a different interpreter (e.g. Homebrew's 3.14 instead
# of setup-python's 3.14t).

Comment thread CMakeLists.txt
Comment on lines +181 to +182
# Python_ROOT_DIR is only a hint; a newer Python elsewhere on the system
# still wins the version scan, so pin the venv's interpreter directly.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# Python_ROOT_DIR is only a hint; a newer Python elsewhere on the system
# still wins the version scan, so pin the venv's interpreter directly.
# Python_ROOT_DIR is only a search hint, so FindPython may select a newer
# Python elsewhere. Set Python_EXECUTABLE to the venv's interpreter path
# to bypass interpreter discovery.

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

Successfully merging this pull request may close these issues.

2 participants