Skip to content

Commit 9b579c9

Browse files
committed
Build py3.15 wheels against the manylinux python.org interpreter (not conda)
The cp315 segfault is a CPython 3.15 *alpha* ABI skew: torch nightly cp315 wheels are built with the python.org /opt/python/cp315-cp315 interpreter, but the build env installed python=3.15.0a8 from conda-forge, whose ABI doesn't match -> 'import torch' segfaults in module init. For 3.15/3.15t, skip conda and build against /opt/python/cp315-cp315[t] (the interpreter that produced the torch wheels). pkg-helpers already prepends that interpreter's bin to PATH, so setting CONDA_RUN='' makes the whole build/smoke-test use it. Build tooling (cmake/ninja/wheel) is pip installed; libpng/libjpeg/libwebp/pkg-config come from the manylinux image. Other versions keep the conda path unchanged.
1 parent e1c24f7 commit 9b579c9

1 file changed

Lines changed: 34 additions & 12 deletions

File tree

.github/actions/setup-binary-builds/action.yml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,44 @@ runs:
129129
set -euxo pipefail
130130
CONDA_ENV="${RUNNER_TEMP}/conda_environment_${GITHUB_RUN_ID}"
131131
export CONDA_EXTRA_PARAM=""
132+
133+
# Python 3.15 is still in pre-release and its C-API/ABI is not frozen.
134+
# conda-forge's python=3.15.0a* does not match the python.org alpha the
135+
# torch nightly cp315 wheels are built against, so importing torch under
136+
# the conda interpreter segfaults during module init. Build against the
137+
# manylinux python.org interpreter that produced the torch wheels
138+
# instead of conda. pkg-helpers already prepends /opt/python/<abi>/bin
139+
# to PATH via BUILD_ENV_FILE, so an empty CONDA_RUN makes every
140+
# `${CONDA_RUN} python|pip` in the build resolve to that interpreter --
141+
# no ABI skew. We only install the build tooling conda used to provide.
142+
case $PYTHON_VERSION in
143+
3.15) MANYLINUX_PYTHON=/opt/python/cp315-cp315/bin/python ;;
144+
3.15t) MANYLINUX_PYTHON=/opt/python/cp315-cp315t/bin/python ;;
145+
*) MANYLINUX_PYTHON="" ;;
146+
esac
147+
148+
if [ -n "${MANYLINUX_PYTHON}" ]; then
149+
if [ ! -x "${MANYLINUX_PYTHON}" ]; then
150+
echo "::error::Expected manylinux interpreter ${MANYLINUX_PYTHON} not found in build image"
151+
exit 1
152+
fi
153+
"${MANYLINUX_PYTHON}" -m pip install --upgrade pip
154+
# Match the build-tooling versions pinned for the conda path below.
155+
# (libpng/libjpeg/libwebp/pkg-config come from the manylinux image's
156+
# system packages rather than conda.)
157+
"${MANYLINUX_PYTHON}" -m pip install \
158+
"cmake==3.31.2" \
159+
"ninja==1.12.1" \
160+
"wheel==0.37.1"
161+
echo "CONDA_ENV=$(dirname "$(dirname "${MANYLINUX_PYTHON}")")" >> "${GITHUB_ENV}"
162+
echo "CONDA_RUN=" >> "${GITHUB_ENV}"
163+
exit 0
164+
fi
165+
132166
conda install -y conda=25.3.0
133167
134168
# shellcheck disable=SC2153
135169
case $PYTHON_VERSION in
136-
3.15t)
137-
# 3.15 is pre-release; conda-forge ships the build under the
138-
# python_dev label, but it depends on the _python_rc marker that
139-
# only lives on the python_rc label, so both are required. Bump
140-
# the pinned alpha/beta as newer pre-releases are published.
141-
export PYTHON_VERSION=3.15.0a8
142-
export CONDA_EXTRA_PARAM=" python-freethreading -c conda-forge/label/python_dev -c conda-forge/label/python_rc -c conda-forge"
143-
;;
144-
3.15)
145-
export PYTHON_VERSION=3.15.0a8
146-
export CONDA_EXTRA_PARAM=" -c conda-forge/label/python_dev -c conda-forge/label/python_rc -c conda-forge"
147-
;;
148170
3.14t)
149171
export PYTHON_VERSION=3.14
150172
export CONDA_EXTRA_PARAM=" python-freethreading"

0 commit comments

Comments
 (0)