-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.py
28 lines (23 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
import os
import subprocess
import sys
def ensure_dependencies():
"""Ensure all dependencies are installed in the correct Python environment"""
# Get the directory where this script is located
script_dir = os.path.dirname(os.path.abspath(__file__))
# Get Python executable path from ComfyUI's environment
python = sys.executable
print("Installing dependencies...")
try:
# Install dependencies using pip in the correct Python environment
subprocess.check_call([python, '-m', 'pip', 'install', '-r',
os.path.join(script_dir, 'requirements.txt')])
print("Dependencies installed successfully!")
except subprocess.CalledProcessError as e:
print(f"Error installing dependencies: {e}")
print("Please try installing them manually using:")
print(f"'{python} -m pip install -r requirements.txt'")
except Exception as e:
print(f"An unexpected error occurred: {e}")
if __name__ == "__main__":
ensure_dependencies()