MCPcopy Create free account
hub / github.com/pytorch/executorch / install_requirements

Function install_requirements

install_requirements.py:34–107  ·  view source on GitHub ↗
(use_pytorch_nightly)

Source from the content-addressed store, hash-verified

32
33
34def install_requirements(use_pytorch_nightly):
35 # Skip pip install on Intel macOS if using nightly.
36 if use_pytorch_nightly and is_intel_mac_os():
37 print(
38 "ERROR: Prebuilt PyTorch wheels are no longer available for Intel-based macOS.\n"
39 "Please build from source by following https://docs.pytorch.org/executorch/main/using-executorch-building-from-source.html",
40 file=sys.stderr,
41 )
42 sys.exit(1)
43
44 # Determine the appropriate PyTorch URL based on CUDA delegate status
45 torch_url = determine_torch_url(TORCH_URL_BASE)
46
47 # pip packages needed by exir.
48 TORCH_PACKAGE = [
49 # Setting use_pytorch_nightly to false to test the pinned PyTorch commit. Note
50 # that we don't need to set any version number there because they have already
51 # been installed on CI before this step, so pip won't reinstall them
52 ("torch==2.12.0" if use_pytorch_nightly else "torch"),
53 ]
54
55 # Install the requirements for core ExecuTorch package.
56 # `--extra-index-url` tells pip to look for package
57 # versions on the provided URL if they aren't available on the default URL.
58 subprocess.run(
59 [
60 sys.executable,
61 "-m",
62 "pip",
63 "install",
64 "--no-cache-dir",
65 "-r",
66 "requirements-dev.txt",
67 *TORCH_PACKAGE,
68 "--extra-index-url",
69 torch_url,
70 ],
71 check=True,
72 )
73
74 LOCAL_REQUIREMENTS = [
75 "third-party/ao", # We need the latest kernels for fast iteration, so not relying on pypi.
76 ] + (
77 [
78 "extension/llm/tokenizers", # TODO(larryliu0820): Setup a pypi package for this.
79 ]
80 if sys.platform != "win32"
81 else []
82 ) # TODO(gjcomer): Re-enable when buildable on Windows.
83
84 # Install packages directly from local copy instead of pypi.
85 # This is usually not recommended.
86 new_env = os.environ.copy()
87 if ("EXECUTORCH_BUILD_KERNELS_TORCHAO" not in new_env) or (
88 new_env["EXECUTORCH_BUILD_KERNELS_TORCHAO"] == "0"
89 ):
90 new_env["USE_CPP"] = "0"
91 else:

Callers 2

mainFunction · 0.90
mainFunction · 0.85

Calls 4

is_intel_mac_osFunction · 0.90
determine_torch_urlFunction · 0.90
runMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected