Skip to content

Commit e5a4e67

Browse files
committed
Add intel-macOS system check
1 parent 0b3c22f commit e5a4e67

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

install_requirements.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ def python_is_compatible():
7575

7676

7777
def install_requirements(use_pytorch_nightly):
78+
# Prevent pip install on Intel-based macOS systems (no prebuilt PyTorch binaries available).
79+
if use_pytorch_nightly and is_intel_mac_os():
80+
sys.exit(1)
81+
7882
# pip packages needed by exir.
7983
TORCH_PACKAGE = [
8084
# Setting use_pytorch_nightly to false to test the pinned PyTorch commit. Note
@@ -163,6 +167,24 @@ def install_optional_example_requirements(use_pytorch_nightly):
163167
)
164168

165169

170+
# Prebuilt binaries for Intel-based macOS are no longer available on PyPI; users must compile from source.
171+
# PyTorch stopped building macOS x86_64 binaries since version 2.3.0 (January 2024).
172+
def is_intel_mac_os():
173+
# Returns True if running on Intel-based macOS
174+
if platform.system().lower() == "darwin" and platform.machine().lower() in (
175+
"x86",
176+
"x86_64",
177+
"i386",
178+
):
179+
print(
180+
"ERROR: Prebuilt PyTorch binaries are no longer available for Intel-based macOS.\n"
181+
"Please compile from source by following https://pytorch.org/executorch/0.6/using-executorch-building-from-source.html",
182+
file=sys.stderr,
183+
)
184+
return True
185+
return False
186+
187+
166188
def main(args):
167189
parser = argparse.ArgumentParser()
168190
parser.add_argument(

0 commit comments

Comments
 (0)