Skip to content

ci: install pinned torch before requirements-ci.txt on macOS#19342

Open
rascani wants to merge 2 commits intopytorch:mainfrom
rascani:reorder-macos-torch-install
Open

ci: install pinned torch before requirements-ci.txt on macOS#19342
rascani wants to merge 2 commits intopytorch:mainfrom
rascani:reorder-macos-torch-install

Conversation

@rascani
Copy link
Copy Markdown
Contributor

@rascani rascani commented May 6, 2026

Summary

setup-macos.sh runs install_pip_dependencies before install_pytorch_and_domains. That order lets torchsr's transitive torch dep get pulled from PyPI before the pinned source-built or S3-cached torch lands; install_pytorch_and_domains then overwrites the wrong-source torch.

The overwrite is small in the current state, but the same race forced --no-cache-dir`. That cascaded reinstalls of every torch transitive dep, pushed the macOS unittest past its 60-minute timeout, until #19334 reverted it.

Reorder so install_pip_dependencies runs after
install_pytorch_and_domains. With torch already at the pinned version, torchsr's dep is satisfied and pip skips re-downloading. Removes the structural footgun so any future re-land of centralized torch install does not need --force-reinstall.

Also rewrite two adjacent comments:

  • Add a comment above install_pytorch_and_domains recording the ordering rationale.
  • Drop the now-misleading "We build PyTorch from source here" comment that drifted above install_executorch; replace with one explaining why install_executorch --use-pt-pinned-commit is correct (torch is already installed).

Authored with Claude Code.

Test plan

CI

`setup-macos.sh` runs `install_pip_dependencies` before
`install_pytorch_and_domains`. That order lets torchsr's transitive
torch dep get pulled from PyPI before the pinned source-built or
S3-cached torch lands; `install_pytorch_and_domains` then overwrites
the wrong-source torch.

The overwrite is small in the current state, but the same race forced
--no-cache-dir`. That cascaded reinstalls of every torch transitive
dep, pushed the macOS unittest past its 60-minute timeout, until pytorch#19334
reverted it.

Reorder so `install_pip_dependencies` runs after
`install_pytorch_and_domains`. With torch already at the pinned
version, torchsr's dep is satisfied and pip skips re-downloading.
Removes the structural footgun so any future re-land of centralized
torch install does not need `--force-reinstall`.

Also rewrite two adjacent comments:
- Add a comment above `install_pytorch_and_domains` recording the
  ordering rationale.
- Drop the now-misleading "We build PyTorch from source here" comment
  that drifted above `install_executorch`; replace with one explaining
  why `install_executorch --use-pt-pinned-commit` is correct (torch is
  already installed).

Authored with Claude Code.
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 6, 2026

🔗 Helpful Links

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

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

❌ 28 Cancelled Jobs, 16 Pending, 5 Unrelated Failures

As of commit f041233 with merge base cdcc915 (image):

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

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@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 May 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

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.

`install_pytorch_and_domains`'s source-build fallback runs `python
setup.py bdist_wheel`, which needs pyyaml, typing-extensions, ninja,
and other PyTorch build-time deps. Those used to be present only
because requirements-ci.txt happened to include them; the previous
commit's reorder removed that incidental coverage and broke the
fallback when the macOS wheel cache misses.

Install PyTorch's own `requirements-build.txt` before the source
build so it owns its deps and is order-independent.

Authored with Claude Code.
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