Skip to content

Build PyTorch wheel via PEP 517 instead of setup.py - #21562

Open
shoumikhin wants to merge 1 commit into
mainfrom
fix-install-pytorch-pep517-build
Open

Build PyTorch wheel via PEP 517 instead of setup.py#21562
shoumikhin wants to merge 1 commit into
mainfrom
fix-install-pytorch-pep517-build

Conversation

@shoumikhin

Copy link
Copy Markdown
Contributor

Problem

Recent PyTorch nightlies removed python setup.py bdist_wheel. PyTorch now builds through scikit-build-core using the standard PEP 517 interface (pyproject.toml). The CI Docker image still builds PyTorch with setup.py, so bumping the pin to a newer nightly fails the image build with:

error: `python setup.py bdist_wheel` is deprecated: PyTorch is built with
scikit-build-core via the standard PEP 517 interface (pyproject.toml)...

Fix

Build the wheel with python -m build --wheel --no-isolation:

  • python -m build is the standard PEP 517 frontend and works with PyTorch's scikit-build-core backend.
  • --no-isolation makes PyTorch build against the image's numpy and toolchain (avoids a build-vs-runtime ABI mismatch) and lets the build reuse sccache.
  • With isolation off the frontend does not install the build requirements, so they are installed explicitly, kept in sync with PyTorch's [build-system].requires.

The produced wheel still lands in dist/, so the install step is unchanged.

Testing

The Docker image build in this PR exercises the new build path end to end.

Recent PyTorch nightlies removed support for "python setup.py bdist_wheel" and build through scikit-build-core (PEP 517) via pyproject.toml. The CI Docker image still built PyTorch with setup.py, so pinning to a newer nightly failed the image build.

Build the wheel with the standard frontend (python -m build) with build isolation disabled, so PyTorch builds against the image's numpy and toolchain and reuses sccache. Install the PEP 517 build requirements explicitly since the frontend does not fetch them when isolation is off.
Copilot AI review requested due to automatic review settings August 4, 2026 01:05
@pytorch-bot

pytorch-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21562

Note: Links to docs will display an error until the docs builds have been completed.

❌ 13 New Failures, 113 Cancelled Jobs, 17 Pending, 12 Unclassified Failures

As of commit 84917ae with merge base 4b4df96 (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

CANCELLED JOBS - The following jobs were cancelled. Please retry:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants