Browse Source

fix: ensure `GitPython` installation in the prestartup_script instead of __init__.py

https://github.com/ltdrdata/ComfyUI-Manager/issues/567
pull/569/head
Dr.Lt.Data 7 months ago
parent
commit
6c0dfb2ed2
  1. 29
      __init__.py
  2. 24
      prestartup_script.py

29
__init__.py

@ -18,7 +18,7 @@ from server import PromptServer
from .glob import manager_core as core
import cm_global
version = [2, 18, 2]
version = [2, 18, 3]
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
print(f"### Loading: ComfyUI-Manager ({version_str})")
@ -78,34 +78,9 @@ class ManagerFuncsInComfyUI(core.ManagerFuncs):
core.manager_funcs = ManagerFuncsInComfyUI()
try:
import git
except:
my_path = os.path.dirname(__file__)
requirements_path = os.path.join(my_path, "requirements.txt")
print(f"## ComfyUI-Manager: installing dependencies")
core.manager_funcs.run_script([sys.executable, '-s', '-m', 'pip', 'install', '-r', requirements_path])
try:
import git
except:
print(f"## [ERROR] ComfyUI-Manager: Attempting to reinstall dependencies using an alternative method.")
core.manager_funcs.run_script([sys.executable, '-s', '-m', 'pip', 'install', '--user', '-r', requirements_path])
try:
import git
except:
print(f"## [ERROR] ComfyUI-Manager: Failed to install the GitPython package in the correct Python environment. Please install it manually in the appropriate environment. (You can seek help at https://app.element.io/#/room/%23comfyui_space%3Amatrix.org)")
print(f"## ComfyUI-Manager: installing dependencies done.")
sys.path.append('../..')
from torchvision.datasets.utils import download_url

24
prestartup_script.py

@ -300,6 +300,30 @@ except Exception as e:
print(f"[ComfyUI-Manager] Logging failed: {e}")
try:
import git
except:
my_path = os.path.dirname(__file__)
requirements_path = os.path.join(my_path, "requirements.txt")
print(f"## ComfyUI-Manager: installing dependencies. (GitPython)")
result = subprocess.check_output([sys.executable, '-s', '-m', 'pip', 'install', '-r', requirements_path])
try:
import git
except:
print(f"## [ERROR] ComfyUI-Manager: Attempting to reinstall dependencies using an alternative method.")
result = subprocess.check_output([sys.executable, '-s', '-m', 'pip', 'install', '--user', '-r', requirements_path])
try:
import git
except:
print(f"## [ERROR] ComfyUI-Manager: Failed to install the GitPython package in the correct Python environment. Please install it manually in the appropriate environment. (You can seek help at https://app.element.io/#/room/%23comfyui_space%3Amatrix.org)")
print(f"## ComfyUI-Manager: installing dependencies done.")
print("** ComfyUI startup time:", datetime.datetime.now())
print("** Platform:", platform.system())
print("** Python version:", sys.version)

Loading…
Cancel
Save