From 1e2aa01a101cd756211f8fefd0439b2e5c3ddb4d Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Thu, 27 Jun 2024 23:58:01 +0900 Subject: [PATCH] allows installing into abnormal custom node directory https://github.com/ltdrdata/ComfyUI-Impact-Pack/issues/2#issuecomment-2191875544 --- impact/subpack_nodes.py | 2 +- install.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/impact/subpack_nodes.py b/impact/subpack_nodes.py index b30a778..d7aff9f 100644 --- a/impact/subpack_nodes.py +++ b/impact/subpack_nodes.py @@ -4,7 +4,7 @@ import impact.core as core import impact.subcore as subcore from impact.utils import add_folder_path_and_extensions -version_code = 21 +version_code = 22 print(f"### Loading: ComfyUI-Impact-Pack (Subpack: V0.6)") diff --git a/install.py b/install.py index 9145fbe..5a55af7 100644 --- a/install.py +++ b/install.py @@ -3,12 +3,19 @@ import sys from torchvision.datasets.utils import download_url subpack_path = os.path.join(os.path.dirname(__file__)) -comfy_path = os.path.join(subpack_path, '..', '..', '..') + +comfy_path = os.environ.get('COMFYUI_PATH') +if comfy_path is None: + print(f"\n[bold yellow]WARN: The `COMFYUI_PATH` environment variable is not set. Assuming `{os.path.dirname(__file__)}/../../../` as the ComfyUI path.[/bold yellow]", file=sys.stderr) + comfy_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')) sys.path.append(comfy_path) -import folder_paths -model_path = folder_paths.models_dir +model_path = os.environ.get('COMFYUI_MODEL_PATH') +if model_path is None: + print(f"\n[bold yellow]WARN: The `COMFYUI_MODEL_PATH` environment variable is not set. Assuming `{model_path}` as the ComfyUI path.[/bold yellow]", file=sys.stderr) + model_path = os.path.abspath(os.path.join(comfy_path, 'models')) + ultralytics_bbox_path = os.path.join(model_path, "ultralytics", "bbox") ultralytics_segm_path = os.path.join(model_path, "ultralytics", "segm")