Skip to content

Commit fc982f6

Browse files
authored
Fix Python 3.15 smoke tests on Windows and Linux (#8357)
`numpy` publishes no cp315 wheels on PyPI, so installing a freshly built wheel under 3.15 / 3.15t falls back to the numpy sdist and tries to build it from source. On Windows that build fails outright in the conda env: ``` ..\meson.build:1:0: ERROR: Cython requires python3 dependency for link testing, but it could not be found error: metadata-generation-failed ``` so `pip install <wheel>` aborts, the wheel is never installed, and the smoke test reports `ModuleNotFoundError: No module named 'torchvision'` — a symptom two steps removed from the cause. cp315 wheels for **both numpy and pillow** are published on `download.pytorch.org` across `cpu / cu126 / cu128 / cu129 / cu130 / xpu`, so for 3.15 / 3.15t this resolves runtime deps from there with `--pre` (numpy is currently `2.6.0.dev0`). All other Python versions install from PyPI exactly as before. ### Changes - **Windows** (`build_wheels_windows.yml`) — both the X64 and ARM64 smoke tests. - **Linux** (`build_wheels_linux.yml`) — re-enables the 3.15 smoke test, which was skipped for exactly this reason, **and** applies the same dependency resolution. Re-enabling it without that would just relocate the failure, since numpy still has no cp315 wheels on PyPI. `--index-url` (rather than `--extra-index-url`) replaces PyPI for that install, so every torchvision runtime dependency has to be present on the pytorch index. Verified for `torch`, `numpy` and `pillow` with cp315 `win_amd64`, `win_arm64` and `manylinux` builds across all of the indices listed above. ### Dropped from the earlier revision The `generate_binary_build_matrix.py` and matrix-test changes are gone. #8427 has since enabled 3.15 / 3.15t by default for every OS and removed the opt-in `include_preview_python_versions` mechanism those hunks extended, so they are obsolete. The `[DO NOT MERGE]` PR-build override is also dropped. ### Follow-up This fixes CI only. A user running `pip install torchvision` on Python 3.15 still cannot satisfy the numpy dependency from PyPI, so 3.15 remains effectively nightly-only until upstream numpy ships cp315 wheels.
1 parent f12f993 commit fc982f6

2 files changed

Lines changed: 27 additions & 9 deletions

File tree

.github/workflows/build_wheels_linux.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,7 @@ jobs:
301301
repository: ${{ inputs.repository }}
302302
script: ${{ inputs.post-script }}
303303
- name: Smoke Test
304-
# Skip the smoke test for Python 3.15 / 3.15t: the wheel builds fine, but
305-
# the smoke test installs the wheel which pulls required runtime deps
306-
# (e.g. pillow, a hard torchvision dependency) that have no cp315 wheels
307-
# yet and fail to build from sdist. Re-enable once the ecosystem ships
308-
# cp315 wheels.
309-
if: ${{ inputs.run-smoke-test && ! startsWith(matrix.python_version, '3.15') }}
304+
if: ${{ inputs.run-smoke-test }}
310305
shell: bash -l {0}
311306
env:
312307
PACKAGE_NAME: ${{ inputs.package-name }}
@@ -317,7 +312,15 @@ jobs:
317312
WHEEL_NAME=$(ls "${{ inputs.repository }}/dist/")
318313
echo "$WHEEL_NAME"
319314
320-
${CONDA_RUN} pip install "${{ inputs.repository }}/dist/$WHEEL_NAME"
315+
# numpy does not publish cp315 wheels on PyPI yet; they are available on
316+
# download.pytorch.org as a pre-release. For 3.15 / 3.15t resolve runtime
317+
# deps from there and allow pre-releases. Other versions use PyPI as before.
318+
if [[ "${{ startsWith(matrix.python_version, '3.15') }}" == "true" ]]; then
319+
${CONDA_RUN} pip install --pre "${{ inputs.repository }}/dist/$WHEEL_NAME" \
320+
--index-url "https://download.pytorch.org/whl/${CHANNEL}/${CU_VERSION}"
321+
else
322+
${CONDA_RUN} pip install "${{ inputs.repository }}/dist/$WHEEL_NAME"
323+
fi
321324
# Checking that we have a pinned version of torch in our dependency tree
322325
(
323326
pushd "${RUNNER_TEMP}"

.github/workflows/build_wheels_windows.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,15 @@ jobs:
362362
source "${BUILD_ENV_FILE}"
363363
WHEEL_NAME=$(ls "${{ inputs.repository }}/dist/")
364364
echo "$WHEEL_NAME"
365-
${CONDA_RUN} pip install "${{ inputs.repository }}/dist/$WHEEL_NAME"
365+
# numpy does not publish cp315 wheels on PyPI yet; they are available on
366+
# download.pytorch.org as a pre-release. For 3.15 / 3.15t resolve runtime
367+
# deps from there and allow pre-releases. Other versions use PyPI as before.
368+
if [[ "${{ startsWith(matrix.python_version, '3.15') }}" == "true" ]]; then
369+
${CONDA_RUN} pip install --pre "${{ inputs.repository }}/dist/$WHEEL_NAME" \
370+
--index-url "https://download.pytorch.org/whl/${CHANNEL}/${CU_VERSION}"
371+
else
372+
${CONDA_RUN} pip install "${{ inputs.repository }}/dist/$WHEEL_NAME"
373+
fi
366374
if [[ ! -f "${{ inputs.repository }}"/${SMOKE_TEST_SCRIPT} ]]; then
367375
echo "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT} not found"
368376
${CONDA_RUN} "${{ inputs.repository }}/${ENV_SCRIPT}" python -c "import ${PACKAGE_NAME}; print('package version is ', ${PACKAGE_NAME}.__version__)"
@@ -380,7 +388,14 @@ jobs:
380388
cd $SRC_DIR
381389
source .venv/Scripts/activate
382390
whl=$(find dist -name "${{env.PACKAGE_NAME}}-*.whl" | head -n 1)
383-
pip install $whl
391+
# See the X64 smoke test above: for 3.15 / 3.15t numpy ships only on
392+
# download.pytorch.org, as a pre-release.
393+
if [[ "${{ startsWith(matrix.python_version, '3.15') }}" == "true" ]]; then
394+
pip install --pre "$whl" \
395+
--index-url "https://download.pytorch.org/whl/${CHANNEL}/${CU_VERSION}"
396+
else
397+
pip install "$whl"
398+
fi
384399
385400
if [[ ! -f ${SMOKE_TEST_SCRIPT} ]]; then
386401
echo "${SMOKE_TEST_SCRIPT} not found"

0 commit comments

Comments
 (0)