@@ -79,6 +79,11 @@ def install_requirements(use_pytorch_nightly):
79
79
80
80
# Skip pip install on Intel macOS if using nightly.
81
81
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
+ )
82
87
sys .exit (1 )
83
88
84
89
# pip packages needed by exir.
@@ -92,14 +97,20 @@ def install_requirements(use_pytorch_nightly):
92
97
EXAMPLES_REQUIREMENTS = []
93
98
94
99
# 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 .
96
101
if not is_intel_mac :
97
102
EXIR_REQUIREMENTS .append (
98
103
f"torchvision==0.22.0.{ NIGHTLY_VERSION } "
104
+ if use_pytorch_nightly
105
+ else "torchvision"
99
106
) # For testing.
100
107
101
108
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
+ )
103
114
]
104
115
105
116
# Assemble the list of requirements to actually install.
@@ -156,18 +167,11 @@ def install_requirements(use_pytorch_nightly):
156
167
# PyTorch stopped building macOS x86_64 binaries since version 2.3.0 (January 2024).
157
168
def is_intel_mac_os ():
158
169
# 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 (
160
171
"x86" ,
161
172
"x86_64" ,
162
173
"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
+ )
171
175
172
176
173
177
def main (args ):
0 commit comments