Skip to content

Commit

Permalink
install_requirements.py: remove unnecessary requirements
Browse files Browse the repository at this point in the history
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: 115e64db5af146cadb72cd5ea8db739312752c83
ghstack-comment-id: 2596313740
Pull Request resolved: #7705
  • Loading branch information
swolchok committed Jan 16, 2025
1 parent 6f72f97 commit d957a59
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
26 changes: 7 additions & 19 deletions install_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,34 +101,16 @@ def install_requirements(use_pytorch_nightly):
if use_pytorch_nightly
else "torchvision"
), # For testing.
"typing-extensions",
]

# pip packages needed to run examples.
# TODO: Make each example publish its own requirements.txt
EXAMPLES_REQUIREMENTS = [
"timm==1.0.7",
f"torchaudio==2.6.0.{NIGHTLY_VERSION}" if use_pytorch_nightly else "torchaudio",
"torchsr==1.0.4",
"transformers==4.47.1",
]

# pip packages needed for development.
DEVEL_REQUIREMENTS = [
"cmake", # For building binary targets.
"pip>=23", # For building the pip package.
"pyyaml", # Imported by the kernel codegen tools.
"setuptools>=63", # For building the pip package.
"tomli", # Imported by extract_sources.py when using python < 3.11.
"wheel", # For building the pip package archive.
"zstd", # Imported by resolve_buck.py.
"ai-edge-model-explorer>=0.1.16", # For visualizing ExportedPrograms
]

# Assemble the list of requirements to actually install.
# TODO: Add options for reducing the number of requirements.
REQUIREMENTS_TO_INSTALL = (
EXIR_REQUIREMENTS + DEVEL_REQUIREMENTS + EXAMPLES_REQUIREMENTS
EXIR_REQUIREMENTS + EXAMPLES_REQUIREMENTS
)

# Install the requirements. `--extra-index-url` tells pip to look for package
Expand All @@ -139,6 +121,10 @@ def install_requirements(use_pytorch_nightly):
"-m",
"pip",
"install",
"-r",
"requirements-dev.txt",
"-r",
"requirements-examples.txt",
*REQUIREMENTS_TO_INSTALL,
"--extra-index-url",
TORCH_NIGHTLY_URL,
Expand All @@ -158,6 +144,8 @@ def install_requirements(use_pytorch_nightly):
"-m",
"pip",
"install",
# Without --no-build-isolation, setup.py can't find the torch module.
"--no-build-isolation",
*LOCAL_REQUIREMENTS,
],
check=True,
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# For visualizing ExportedPrograms
ai-edge-model-explorer >= 0.1.16
5 changes: 5 additions & 0 deletions requirements-examples.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# pip packages needed to run examples.
# TODO: Make each example publish its own requirements.txt
timm == 1.0.7
torchsr == 1.0.4
transformers ==4.47.1

0 comments on commit d957a59

Please sign in to comment.