Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dist/
ethos-u-scratch/
executorch.egg-info
pip-out/
constraints.txt

# Any exported models and profiling outputs
*.bin
Expand Down
2 changes: 2 additions & 0 deletions install_executorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def clean():
print("ccache not found, skipping ccache cleanup.")
except (subprocess.CalledProcessError, FileNotFoundError):
print("ccache not found, skipping ccache cleanup.")

shutil.rmtree("constraints.txt", ignore_errors=True)

print("Done cleaning build artifacts.")

Expand Down
50 changes: 37 additions & 13 deletions install_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,6 @@


def install_optional_example_requirements(use_pytorch_nightly):
print("Installing packages in requirements-examples.txt")
subprocess.run(
[
sys.executable,
"-m",
"pip",
"install",
"-r",
"requirements-examples.txt",
],
check=True,
)

print("Installing torch domain libraries")
DOMAIN_LIBRARIES = [
(
Expand All @@ -179,6 +166,43 @@
)


print("Installing packages in requirements-examples.txt")
try:
import torch
import torchvision

Check failure on line 172 in install_requirements.py

View workflow job for this annotation

GitHub Actions / lintrunner / linux-job

MYPY import-untyped

Skipping analyzing "torchvision": module is installed, but missing library stubs or py.typed marker To disable, use ` # type: ignore[import-untyped]`
import torchaudio

Check failure on line 173 in install_requirements.py

View workflow job for this annotation

GitHub Actions / lintrunner / linux-job

MYPY import-untyped

Skipping analyzing "torchaudio": module is installed, but missing library stubs or py.typed marker To disable, use ` # type: ignore[import-untyped]`
torch_version = torch.__version__
torchvision_version = torchvision.__version__
torchaudio_version = torchaudio.__version__
except ImportError as e:
print(f"Error: Required package not installed: {e}")
sys.exit(1)

with open("constraints.txt", "w") as f:
f.write(f"torch=={torch_version}\n")
f.write(f"torchvision=={torchvision_version}\n")
f.write(f"torchaudio=={torchaudio_version}\n")

# Packages in requirements-example (e.g., timm) may require torch, torchvision et
# pip searches PyPI and finds torch stable release and thinks this is "newer" than your dev version
# Uninstalls torch nightly and installs a stable release version, which is older.
subprocess.run(
[
sys.executable,
"-m",
"pip",
"install",
"-r",
"requirements-examples.txt",
"-c",
"constraints.txt",
],
check=True,
)

os.remove("constraints.txt")


# Prebuilt binaries for Intel-based macOS are no longer available on PyPI; users must compile from source.
# PyTorch stopped building macOS x86_64 binaries since version 2.3.0 (January 2024).
def is_intel_mac_os():
Expand Down
Loading