Skip to content

Commit 20d664c

Browse files
committed
Restore fallback installs for audio and vision; move print statement; update docs url
1 parent 35ecca2 commit 20d664c

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

install_requirements.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ def install_requirements(use_pytorch_nightly):
7979

8080
# Skip pip install on Intel macOS if using nightly.
8181
if use_pytorch_nightly and is_intel_mac:
82+
print(
83+
"ERROR: Prebuilt PyTorch wheels are no longer available for Intel-based macOS.\n"
84+
"Please build from source by following https://docs.pytorch.org/executorch/main/using-executorch-building-from-source.html",
85+
file=sys.stderr,
86+
)
8287
sys.exit(1)
8388

8489
# pip packages needed by exir.
@@ -92,14 +97,20 @@ def install_requirements(use_pytorch_nightly):
9297
EXAMPLES_REQUIREMENTS = []
9398

9499
# Only pip install torchvision and torchaudio if not building PyTorch from source on Intel macOS,
95-
# to avoid installing incompatible prebuilt wheels from PyPI.
100+
# to avoid having incompatible prebuilt wheels from PyPI installed.
96101
if not is_intel_mac:
97102
EXIR_REQUIREMENTS.append(
98103
f"torchvision==0.22.0.{NIGHTLY_VERSION}"
104+
if use_pytorch_nightly
105+
else "torchvision"
99106
) # For testing.
100107

101108
EXAMPLES_REQUIREMENTS = [
102-
f"torchaudio==2.6.0.{NIGHTLY_VERSION}",
109+
(
110+
f"torchaudio==2.6.0.{NIGHTLY_VERSION}"
111+
if use_pytorch_nightly
112+
else "torchaudio"
113+
)
103114
]
104115

105116
# Assemble the list of requirements to actually install.
@@ -156,18 +167,11 @@ def install_requirements(use_pytorch_nightly):
156167
# PyTorch stopped building macOS x86_64 binaries since version 2.3.0 (January 2024).
157168
def is_intel_mac_os():
158169
# Returns True if running on Intel macOS
159-
if platform.system().lower() == "darwin" and platform.machine().lower() in (
170+
return platform.system().lower() == "darwin" and platform.machine().lower() in (
160171
"x86",
161172
"x86_64",
162173
"i386",
163-
):
164-
print(
165-
"ERROR: Prebuilt PyTorch wheels are no longer available for Intel-based macOS.\n"
166-
"Please build from source by following https://pytorch.org/executorch/0.6/using-executorch-building-from-source.html",
167-
file=sys.stderr,
168-
)
169-
return True
170-
return False
174+
)
171175

172176

173177
def main(args):

0 commit comments

Comments
 (0)