-
Notifications
You must be signed in to change notification settings - Fork 103
/
install.py
34 lines (32 loc) · 1.03 KB
/
install.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import subprocess
import sys
required_packages = {
"accelerate": "accelerate",
"diffusers": "diffusers",
"huggingface_hub": "huggingface-hub",
"numpy": "numpy",
"cv2": "opencv-python",
"PIL": "Pillow",
"segment_anything": "segment-anything",
"transformers": "transformers",
"ultralytics": "ultralytics",
"tqdm": "tqdm",
"packaging": "packaging",
"loguru": "loguru",
"rich": "rich",
"pydantic": "pydantic",
"timm": "timm",
"onnxruntime": "onnxruntime",
"hydra": "hydra-core",
"iopath": "iopath",
}
for package, install_name in required_packages.items():
try:
__import__(package)
# print(f"{package} is already installed.")
except ImportError:
try:
subprocess.run([sys.executable, "-m", "pip", "install", install_name], check=True)
print(f"Successfully installed {install_name}.")
except subprocess.CalledProcessError:
print(f"Can't install {install_name}. Please follow the readme to install manually.")