-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstall.py
30 lines (29 loc) · 1.02 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
import subprocess
import sys
import importlib
if __name__ == "__main__":
try:
print("Checking for required dependencies")
importlib.import_module("main")
except ImportError:
print("Not found. Installing required modules")
try:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'pip'])
subprocess.check_call(
[
sys.executable,
"-m",
"pip",
"install",
"torch",
"torchvision",
"--index-url",
"https://download.pytorch.org/whl/cu118",
]
)
subprocess.check_call(
[sys.executable, "-m", "pip", "install", "-r", "requirements.txt"]
)
print("Successfully installed module dependencies")
except subprocess.CalledProcessError as e:
print(f"Failed to install module dependencies: {e}")