Skip to content

Commit 41cb676

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: a5e20ad ghstack-comment-id: 2596313740 Pull Request resolved: #7705
1 parent 79058cd commit 41cb676

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

install_requirements.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -101,35 +101,15 @@ 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.
130-
REQUIREMENTS_TO_INSTALL = (
131-
EXIR_REQUIREMENTS + DEVEL_REQUIREMENTS + EXAMPLES_REQUIREMENTS
132-
)
112+
REQUIREMENTS_TO_INSTALL = EXIR_REQUIREMENTS + EXAMPLES_REQUIREMENTS
133113

134114
# Install the requirements. `--extra-index-url` tells pip to look for package
135115
# versions on the provided URL if they aren't available on the default URL.
@@ -139,6 +119,10 @@ def install_requirements(use_pytorch_nightly):
139119
"-m",
140120
"pip",
141121
"install",
122+
"-r",
123+
"requirements-dev.txt",
124+
"-r",
125+
"requirements-examples.txt",
142126
*REQUIREMENTS_TO_INSTALL,
143127
"--extra-index-url",
144128
TORCH_NIGHTLY_URL,
@@ -158,6 +142,8 @@ def install_requirements(use_pytorch_nightly):
158142
"-m",
159143
"pip",
160144
"install",
145+
# Without --no-build-isolation, setup.py can't find the torch module.
146+
"--no-build-isolation",
161147
*LOCAL_REQUIREMENTS,
162148
],
163149
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)