Skip to content

Commit 5b9ab56

Browse files
authored
install_requirements.py: reorganize requirements (#7705)
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
1 parent eaad7ff commit 5b9ab56

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

install_requirements.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -104,34 +104,15 @@ def install_requirements(use_pytorch_nightly):
104104
if use_pytorch_nightly
105105
else "torchvision"
106106
), # For testing.
107-
"typing-extensions",
108107
]
109108

110-
# pip packages needed to run examples.
111-
# TODO: Make each example publish its own requirements.txt
112109
EXAMPLES_REQUIREMENTS = [
113-
"timm==1.0.7",
114110
f"torchaudio==2.6.0.{NIGHTLY_VERSION}" if use_pytorch_nightly else "torchaudio",
115-
"torchsr==1.0.4",
116-
"transformers==4.47.1",
117-
]
118-
119-
# pip packages needed for development.
120-
DEVEL_REQUIREMENTS = [
121-
"cmake", # For building binary targets.
122-
"pip>=23", # For building the pip package.
123-
"pyyaml", # Imported by the kernel codegen tools.
124-
"setuptools>=63", # For building the pip package.
125-
"tomli", # Imported by extract_sources.py when using python < 3.11.
126-
"wheel", # For building the pip package archive.
127-
"zstd", # Imported by resolve_buck.py.
128111
]
129112

130113
# Assemble the list of requirements to actually install.
131114
# TODO: Add options for reducing the number of requirements.
132-
REQUIREMENTS_TO_INSTALL = (
133-
EXIR_REQUIREMENTS + DEVEL_REQUIREMENTS + EXAMPLES_REQUIREMENTS
134-
)
115+
REQUIREMENTS_TO_INSTALL = EXIR_REQUIREMENTS + EXAMPLES_REQUIREMENTS
135116

136117
# Install the requirements. `--extra-index-url` tells pip to look for package
137118
# versions on the provided URL if they aren't available on the default URL.
@@ -141,6 +122,8 @@ def install_requirements(use_pytorch_nightly):
141122
"-m",
142123
"pip",
143124
"install",
125+
"-r",
126+
"requirements-examples.txt",
144127
*REQUIREMENTS_TO_INSTALL,
145128
"--extra-index-url",
146129
TORCH_NIGHTLY_URL,
@@ -160,6 +143,8 @@ def install_requirements(use_pytorch_nightly):
160143
"-m",
161144
"pip",
162145
"install",
146+
# Without --no-build-isolation, setup.py can't find the torch module.
147+
"--no-build-isolation",
163148
*LOCAL_REQUIREMENTS,
164149
],
165150
check=True,

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)