-
Notifications
You must be signed in to change notification settings - Fork 608
Update install script and building from source docs #10652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update install script and building from source docs #10652
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/10652
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit df9c97a with merge base 7b39a0c ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@pytorchbot label "module: build/install" |
@pytorchbot label "release notes: build" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @keyprocedure
Overall looks great. Thank you for testing end-to-end. Glad that it works.
Please see inline comments below.
install_requirements.py
Outdated
): | ||
print( | ||
"ERROR: Prebuilt PyTorch wheels are no longer available for Intel-based macOS.\n" | ||
"Please build from source by following https://pytorch.org/executorch/0.6/using-executorch-building-from-source.html", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://pytorch.org/executorch/0.6/ -> change this to https://pytorch.org/executorch/main/
install_requirements.py
Outdated
print( | ||
"ERROR: Prebuilt PyTorch wheels are no longer available for Intel-based macOS.\n" | ||
"Please build from source by following https://pytorch.org/executorch/0.6/using-executorch-building-from-source.html", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The print message should appear inside this block.
if use_pytorch_nightly and is_intel_mac:
is_intel_mac_os()
is just a getter function that should do any printing.
install_requirements.py
Outdated
) # For testing. | ||
|
||
EXAMPLES_REQUIREMENTS = [ | ||
f"torchaudio==2.6.0.{NIGHTLY_VERSION}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about this logic?
f"torchaudio==2.6.0.{NIGHTLY_VERSION}" if use_pytorch_nightly else "torchaudio"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had removed it for testing and forgot to restore it. Updated the code :)
Hi @mergennachin, I’ve made the requested changes — could you please take a look when you get a chance? |
To add the ciflow label This helps ensure we don't trigger CI on this PR until it is actually authorized to do so. Please ping one of the reviewers if you do not have access to approve and run workflows. |
Thanks @keyprocedure I just started the full CI tests |
To add the ciflow label This helps ensure we don't trigger CI on this PR until it is actually authorized to do so. Please ping one of the reviewers if you do not have access to approve and run workflows. |
@mergennachin Is the expectation that any torch version should be usable, or only ones compatible with the current dependencies? If any torch version should be usable, would it make more sense to use a temporary |
@keyprocedure - First of all, thanks for being patient with this PR. Looking a bit more into it. Why do we need Presumably, when you install torch from source manually as first step, it should install a newer version from source. And in the install_requirements.py step, perhaps it won't try to upgrade it. Do you know which package is transitively trying to upgrade it? |
@mergennachin Sorry for the delay It looks like the torch version is actually downgraded to fit the dependency requirements. I'm not sure which package is causing the version change, but I recently tried to install executorch with the latest torch build without the no-deps flag and after running
|
If the downgrade is being caused by something that I'm doing incorrectly during the install process/isolated to my build, I can remove the no-deps flag from the pip install command for this PR. I'm open to any suggestions/guidance. |
I did some digging and found out that torchvision and torchaudio were in fact downgrading. torch, torchvision and torchaudio are in lock step dependency. I did some refactoring in (#11653). torchvision and torchaudio are not absolute necessity. Only used for examples. Once that PR is landed, we can update the Intel instruction to be as follows:
|
Hey @mergennachin, I really appreciate your follow up! Perfect, that'll simplify things. |
I just landed the PR, please rebase. Hopefully it will simplify a lot of things in this PR |
…ons built from source
9158045
to
a47238b
Compare
@mergennachin I've rebased and updated the Intel macOS install instructions to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline
Use the [`--use-pt-pinned-commit` flag](https://github.com/pytorch/executorch/blob/main/install_executorch.sh) to install Executorch with an existing PyTorch build. | ||
See the [PyTorch instructions](https://github.com/pytorch/pytorch#installation) on how to build PyTorch from source. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use relative paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the flag
links to use relative paths to the .py
file.
For the PyTorch instructions
link, since it points to a doc in the PyTorch repo, is there a way to reference that using a relative path, or should we keep the current path?
docs/source/using-executorch-ios.md
Outdated
@@ -114,6 +114,13 @@ python3 -m venv .venv && source .venv/bin/activate && pip install --upgrade pip | |||
./backends/apple/coreml/scripts/install_requirements.sh | |||
``` | |||
|
|||
- **Intel-based macOS** systems require building PyTorch, Torchvision, and Torchaudio from source: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not have two instructions. Let's consolidate Intel based instructions in "building from source section" and call it a day
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, moved the instructions.
./install_executorch.sh | ||
``` | ||
|
||
Use the [`--use-pt-pinned-commit` flag](https://github.com/pytorch/executorch/blob/main/install_executorch.sh) to install Executorch with an existing PyTorch build. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Executorch/ExecuTorch/g
I removed the mention of building |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @keyprocedure
Happy to help! |
### Summary - Updated `install_requirements.sh` to improve compatibility with source-built PyTorch and Intel macOS systems. - Added checks to prevent install commands from altering existing PyTorch builds by adding the `--no-deps` flag. - Removed `torchaudio` and `torchvision` dependencies for Intel macOS systems to avoid compatibility issues. Fixes pytorch#9772 ### Test plan Tested executorch installations with source-built PyTorch on: - Intel-macOS with PyTorch 2.7.0, Python 3.12.9 - ARM64 macOS with PyTorch 2.8.0a0, Python 3.12.9 Validated by exporting and running the MobileNet V2 image classification model, following the examples on the [Getting Started with ExecuTorch](https://pytorch.org/executorch/stable/getting-started.html) page. cc @larryliu0820 @jathu
Summary
install_requirements.sh
to improve compatibility with source-built PyTorch and Intel macOS systems.--no-deps
flag.torchaudio
andtorchvision
dependencies for Intel macOS systems to avoid compatibility issues.Fixes #9772
Test plan
Tested executorch installations with source-built PyTorch on:
Validated by exporting and running the MobileNet V2 image classification model, following the examples on the Getting Started with ExecuTorch page.
cc @larryliu0820 @jathu