Fix Python 3.15 validation on Linux, Windows and macOS - #8443
Merged
Conversation
Now that 3.15/3.15t are in the default matrix on every OS (pytorch#8427), the uv-based interpreter setup runs on Windows and macOS for the first time and breaks in three places: 1. Windows: uv lays a venv out as Scripts/, not bin/, so `source ${ENV_NAME}/bin/activate` failed outright with "conda-env-<id>/bin/activate: No such file or directory". 2. macOS: the macos-arm64 workaround prepends ${CONDA_PREFIX}/bin to PATH. On the uv path no conda env was activated, so CONDA_PREFIX still pointed at base (python 3.14) and shadowed the venv's python3/pip3 -- the run installed and smoke-tested torch under conda base 3.14 instead of 3.15. 3. Cleanup: ENV_NAME is a conda env name on the conda path but a venv directory on the uv path, so `conda env remove -n` fails with EnvironmentLocationNotFound and, under set -e, fails the job after the tests have already passed. The conda path for 3.10-3.14t is unchanged.
|
@atalman is attempting to deploy a commit to the Meta Open Source Team on Vercel. A member of the Team first needs to authorize it. |
`import torch` segfaults with every published cp315 wheel under the 3.15.0b1
build. The crash is pybind11 3.0.4's gil_scoped_acquire teardown in
python_tracer::init(), reached from torch._C._autograd_init():
THPAutograd_initExtension -> python_tracer::init()
-> ~gil_scoped_acquire() -> dec_ref() -> PyThreadState_Clear -> SIGSEGV
The same wheel imports and runs cleanly under 3.15.0b4, so bump the pin. This
is what has been failing every Linux and aarch64 3.15 leg.
atalman
force-pushed
the
atalman/fix-py315-validation
branch
from
August 5, 2026 15:48
3ef6a65 to
251ff5b
Compare
…ource
PyPI publishes no cp315/cp315t numpy wheels, so `pip install numpy` in the
smoke-test step falls back to a source build. That is merely slow on Linux and
macOS, but a hard failure on Windows:
numpy/_core/src/common/simd/simd.h(4): fatal error C1083:
Cannot open include file: 'stdalign.h': No such file or directory
error: metadata-generation-failed
download.pytorch.org/whl/nightly carries preview cp315 and cp315t numpy wheels
for every platform (manylinux x86_64/aarch64, macosx arm64/x86_64, win_amd64),
so pull numpy from there for 3.15 and forbid a source fallback with
--only-binary=:all:. Other python versions keep using PyPI unchanged.
atalman
force-pushed
the
atalman/fix-py315-validation
branch
from
August 5, 2026 16:36
264be37 to
11056ed
Compare
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.
What
Makes Python 3.15 / 3.15t binary validation actually work, on every platform.
#8427 put 3.15 in the default matrix for all OSes, which exposed the uv-based
interpreter setup in
validate_binaries.sh— previously Linux-only — to Windowsand macOS. Four bugs, all in that one script:
1. Wrong interpreter pinned (all platforms).
import torchsegfaults withevery published cp315 wheel under CPython 3.15.0b1, which is what the script
provisioned. The crash is pybind11 3.0.4's
gil_scoped_acquireteardown inpython_tracer::init(), reached fromtorch._C._autograd_init():The same wheel imports and runs fine under 3.15.0b4, so the pin moves to b4.
Verified locally on both interpreters, and with the oldest (
dev20260724) andnewest (
dev20260805) cp315 nightlies.2. Windows could not activate the venv. uv lays a venv out as
Scripts/, notbin/— it says so in the log line right above the failure:3. macOS silently validated the wrong Python. The
macos-arm64workaroundprepends
${CONDA_PREFIX}/binto PATH. On the uv path no conda env is activated,so
CONDA_PREFIXstill pointed at base (python 3.14) and shadowed the venv.The job did not error — it installed and smoke-tested torch under 3.14, i.e. the
3.15 leg was reporting 3.14 results. The prepend is now skipped on the uv path.
4. Cleanup failed after a green run.
ENV_NAMEis a conda env name on theconda path but a venv directory on the uv path, so
conda env remove -nfailswith
EnvironmentLocationNotFoundand, underset -e, fails the job after thetests passed. The uv path now deactivates and
rm -rfs the directory.5. numpy built from source on Windows. PyPI publishes no cp315/cp315t numpy
wheels, so the smoke-test step's
pip install numpy --upgradefalls back to asource build — slow on Linux/macOS, fatal on Windows:
download.pytorch.org/whl/nightlyalready carries preview cp315 and cp315t numpywheels for every platform including
win_amd64, so 3.15 pulls numpy from therewith
--only-binary=:all:to forbid a source fallback. Other Python versionskeep using PyPI unchanged.
The conda path for 3.10–3.14t is untouched throughout.
Test plan
Validated end-to-end with a temporary commit that pointed the workflow checkouts
at this branch and forced PR builds to 3.15 (that commit has been removed;
this PR is now the three real commits, one file).
Final run — every 3.15 leg green:
Also:
bash -nclean;shellcheck -S warningreports only the pre-existingline-181 finding; the 11 matrix unit tests pass.
Follow-ups (not in this PR)
validate-*-binaries.ymlworkflows passtest-infra-ref, sogenerate_binary_build_matrix.ymldefaults it tomainand the*_job.ymltemplates to
"". Both the matrix generator andvalidate_binaries.sharetherefore always taken from
main— no PR touching this script can testitself without a temporary commit like the one used above. Worth fixing
properly.
coverage here. It was verified locally on b4 (GIL genuinely disabled, matmul
correct, and cp315t numpy wheels exist on the nightly index).
gil_scoped_acquirefragility behind the b1 segfault is real andstill worth reporting upstream, even though b4 avoids it.