Skip to content

Commit d957a59

Browse files
committed
install_requirements.py: remove unnecessary requirements
Duplicate requirements with the pyproject.toml > /dev/null One unique devel reqiurement > requirements-dev.txt Examples requirements > requirements-examples.txt Nightlies stayed in the script. Rationale: be as "normal" a Python project as seemed possible. Test Plan: install_requirements.sh in a clean venv succeeded ghstack-source-id: 115e64d ghstack-comment-id: 2596313740 Pull Request resolved: #7705
1 parent 6f72f97 commit d957a59

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

install_requirements.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,34 +101,16 @@ def install_requirements(use_pytorch_nightly):
101101
if use_pytorch_nightly
102102
else "torchvision"
103103
), # For testing.
104-
"typing-extensions",
105104
]
106105

107-
# pip packages needed to run examples.
108-
# TODO: Make each example publish its own requirements.txt
109106
EXAMPLES_REQUIREMENTS = [
110-
"timm==1.0.7",
111107
f"torchaudio==2.6.0.{NIGHTLY_VERSION}" if use_pytorch_nightly else "torchaudio",
112-
"torchsr==1.0.4",
113-
"transformers==4.47.1",
114-
]
115-
116-
# pip packages needed for development.
117-
DEVEL_REQUIREMENTS = [
118-
"cmake", # For building binary targets.
119-
"pip>=23", # For building the pip package.
120-
"pyyaml", # Imported by the kernel codegen tools.
121-
"setuptools>=63", # For building the pip package.
122-
"tomli", # Imported by extract_sources.py when using python < 3.11.
123-
"wheel", # For building the pip package archive.
124-
"zstd", # Imported by resolve_buck.py.
125-
"ai-edge-model-explorer>=0.1.16", # For visualizing ExportedPrograms
126108
]
127109

128110
# Assemble the list of requirements to actually install.
129111
# TODO: Add options for reducing the number of requirements.
130112
REQUIREMENTS_TO_INSTALL = (
131-
EXIR_REQUIREMENTS + DEVEL_REQUIREMENTS + EXAMPLES_REQUIREMENTS
113+
EXIR_REQUIREMENTS + EXAMPLES_REQUIREMENTS
132114
)
133115

134116
# Install the requirements. `--extra-index-url` tells pip to look for package
@@ -139,6 +121,10 @@ def install_requirements(use_pytorch_nightly):
139121
"-m",
140122
"pip",
141123
"install",
124+
"-r",
125+
"requirements-dev.txt",
126+
"-r",
127+
"requirements-examples.txt",
142128
*REQUIREMENTS_TO_INSTALL,
143129
"--extra-index-url",
144130
TORCH_NIGHTLY_URL,
@@ -158,6 +144,8 @@ def install_requirements(use_pytorch_nightly):
158144
"-m",
159145
"pip",
160146
"install",
147+
# Without --no-build-isolation, setup.py can't find the torch module.
148+
"--no-build-isolation",
161149
*LOCAL_REQUIREMENTS,
162150
],
163151
check=True,

requirements-dev.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# For visualizing ExportedPrograms
2+
ai-edge-model-explorer >= 0.1.16

requirements-examples.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# pip packages needed to run examples.
2+
# TODO: Make each example publish its own requirements.txt
3+
timm == 1.0.7
4+
torchsr == 1.0.4
5+
transformers ==4.47.1

0 commit comments

Comments
 (0)