hiddenswitch / ComfyUI

A powerful and modular stable diffusion GUI with a graph/nodes interface.
GNU General Public License v3.0
30 stars 10 forks source link

How to use existing custom nodes #3

Open iRohith opened 5 months ago

iRohith commented 5 months ago

Excellent project. I am trying to use existing custom nodes. I created directories using "comfyui --create-directories". But adding existing custom nodes to the custom_nodes directory not working.

doctorpangloss commented 5 months ago

let me know which custom nodes you want to add, and i'll ensure they all work

iRohith commented 5 months ago

I am trying to create a serverless comfyui service using your code by using CPUs for frontend and GPUs for backend. I want the users to be able install any existing custom_node. If you can explain me how to make existing custom_nodes compatible with your code, I can write a script myself to automate the process. Just give me pointers. For now I am using the following custom nodes:

https://github.com/jags111/efficiency-nodes-comfyui https://github.com/ltdrdata/ComfyUI-Impact-Pack https://github.com/chaojie/ComfyUI-RAFT https://github.com/huxiuhan/ComfyUI-InstantID https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet https://github.com/Fannovel16/comfyui_controlnet_aux https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite https://github.com/ltdrdata/ComfyUI-Inspire-Pack https://github.com/cubiq/ComfyUI_IPAdapter_plus https://github.com/BadCafeCode/masquerade-nodes-comfyui https://github.com/ssitu/ComfyUI_UltimateSDUpscale

doctorpangloss commented 5 months ago

Thanks, give it a try now.

iRohith commented 5 months ago

Thanks for the quick fix. ComfyUI-Advanced-ControlNet, ComfyUI-AnimateDiff-Evolved, ComfyUI-Inspire-Pack, ComfyUI-VideoHelperSuite, ComfyUI-Impact-Pack custom_nodes are failing to import. Comfyroll custom_nodes partial importing. Also it seems like custom_nodes import is happening twice. Full log:

** ComfyUI startup time: 2024-02-29 08:09:37.668492
** Platform: Linux
** Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
** Python executable: /home/rix/ComfyUI/venv/bin/python3
** Log path: /home/rix/ComfyUI/comfyui.log

Prestartup times for custom nodes:
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI-Manager

Total VRAM 4096 MB, total RAM 7836 MB
Trying to enable lowvram mode because your GPU seems to have 4GB or less. If you don't want this use: --normalvram
xformers version: 0.0.24+cu118
Set vram state to: LOW_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3050 Laptop GPU : cudaMallocAsync
VAE dtype: torch.bfloat16
Using xformers cross attention
Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/__init__.py", line 1, in <module>
    from .adv_control.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/nodes.py", line 7, in <module>
    from .control import load_controlnet, convert_to_advanced, is_advanced_controlnet
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control.py", line 11, in <module>
    from model_patcher import ModelPatcher
ModuleNotFoundError: No module named 'model_patcher'

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet module for custom nodes: No module named 'model_patcher'
Efficiency Nodes: Attempting to add Control Net options to the 'HiRes-Fix Script' Node (comfyui_controlnet_aux add-on)...Success!
WAS Node Suite: OpenCV Python FFMPEG support is enabled
WAS Node Suite Warning: `ffmpeg_bin_path` is not set in `/home/rix/ComfyUI/custom_nodes/was-node-suite-comfyui/was_suite_config.json` config file. Will attempt to use system ffmpeg binaries if available.
WAS Node Suite: Finished. Loaded 211 nodes successfully.

        "Art is not a thing; it is a way." - Elbert Hubbard

Requirement already satisfied: segment_anything in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from -r requirements.txt (line 1)) (1.0)
Requirement already satisfied: timm in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from -r requirements.txt (line 2)) (0.9.16)
Requirement already satisfied: addict in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from -r requirements.txt (line 3)) (2.4.0)
Requirement already satisfied: yapf in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from -r requirements.txt (line 4)) (0.40.2)
Requirement already satisfied: safetensors in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from timm->-r requirements.txt (line 2)) (0.4.2)
Requirement already satisfied: torchvision in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from timm->-r requirements.txt (line 2)) (0.17.0+cu118)
Requirement already satisfied: huggingface_hub in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from timm->-r requirements.txt (line 2)) (0.21.2)
Requirement already satisfied: pyyaml in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from timm->-r requirements.txt (line 2)) (6.0.1)
Requirement already satisfied: torch in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from timm->-r requirements.txt (line 2)) (2.2.0+cu118)
Requirement already satisfied: tomli>=2.0.1 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from yapf->-r requirements.txt (line 4)) (2.0.1)
Requirement already satisfied: importlib-metadata>=6.6.0 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from yapf->-r requirements.txt (line 4)) (7.0.1)
Requirement already satisfied: platformdirs>=3.5.1 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from yapf->-r requirements.txt (line 4)) (4.2.0)
Requirement already satisfied: zipp>=0.5 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from importlib-metadata>=6.6.0->yapf->-r requirements.txt (line 4)) (3.17.0)
Requirement already satisfied: tqdm>=4.42.1 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from huggingface_hub->timm->-r requirements.txt (line 2)) (4.66.2)
Requirement already satisfied: requests in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from huggingface_hub->timm->-r requirements.txt (line 2)) (2.31.0)
Requirement already satisfied: fsspec>=2023.5.0 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from huggingface_hub->timm->-r requirements.txt (line 2)) (2024.2.0)
Requirement already satisfied: filelock in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from huggingface_hub->timm->-r requirements.txt (line 2)) (3.13.1)
Requirement already satisfied: packaging>=20.9 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from huggingface_hub->timm->-r requirements.txt (line 2)) (23.2)
Requirement already satisfied: typing-extensions>=3.7.4.3 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from huggingface_hub->timm->-r requirements.txt (line 2)) (4.10.0)
Requirement already satisfied: nvidia-cusolver-cu11==11.4.1.48 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (11.4.1.48)
Requirement already satisfied: nvidia-cuda-runtime-cu11==11.8.89 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (11.8.89)
Requirement already satisfied: triton==2.2.0 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (2.2.0)
Requirement already satisfied: nvidia-nvtx-cu11==11.8.86 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (11.8.86)
Requirement already satisfied: sympy in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (1.12)
Requirement already satisfied: nvidia-nccl-cu11==2.19.3 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (2.19.3)
Requirement already satisfied: networkx in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (3.2.1)
Requirement already satisfied: nvidia-cudnn-cu11==8.7.0.84 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (8.7.0.84)
Requirement already satisfied: nvidia-cusparse-cu11==11.7.5.86 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (11.7.5.86)
Requirement already satisfied: nvidia-cublas-cu11==11.11.3.6 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (11.11.3.6)
Requirement already satisfied: nvidia-curand-cu11==10.3.0.86 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (10.3.0.86)
Requirement already satisfied: jinja2 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (3.1.3)
Requirement already satisfied: nvidia-cuda-nvrtc-cu11==11.8.89 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (11.8.89)
Requirement already satisfied: nvidia-cuda-cupti-cu11==11.8.87 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (11.8.87)
Requirement already satisfied: nvidia-cufft-cu11==10.9.0.58 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torch->timm->-r requirements.txt (line 2)) (10.9.0.58)
Requirement already satisfied: numpy in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torchvision->timm->-r requirements.txt (line 2)) (1.24.4)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from torchvision->timm->-r requirements.txt (line 2)) (9.5.0)
Requirement already satisfied: MarkupSafe>=2.0 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from jinja2->torch->timm->-r requirements.txt (line 2)) (2.1.5)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from requests->huggingface_hub->timm->-r requirements.txt (line 2)) (2.2.1)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from requests->huggingface_hub->timm->-r requirements.txt (line 2)) (3.3.2)
Requirement already satisfied: certifi>=2017.4.17 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from requests->huggingface_hub->timm->-r requirements.txt (line 2)) (2024.2.2)
Requirement already satisfied: idna<4,>=2.5 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from requests->huggingface_hub->timm->-r requirements.txt (line 2)) (3.6)
Requirement already satisfied: mpmath>=0.19 in /home/rix/ComfyUI/venv/lib/python3.10/site-packages (from sympy->torch->timm->-r requirements.txt (line 2)) (1.3.0)
Comfyroll Studio: Failed to load Essential nodes
Comfyroll Studio: Failed to load Graphics nodes
Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI_Comfyroll_CustomNodes/__init__.py", line 21, in <module>
    from .node_mappings import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI_Comfyroll_CustomNodes/node_mappings.py", line 50, in <module>
    "CR Image Output": CR_ImageOutput,
NameError: name 'CR_ImageOutput' is not defined

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI_Comfyroll_CustomNodes module for custom nodes: name 'CR_ImageOutput' is not defined
Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/__init__.py", line 3, in <module>
    from .animatediff.utils_model import get_available_motion_models, Folders
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/utils_model.py", line 34, in <module>
    class ModelSamplingType:
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/utils_model.py", line 45, in ModelSamplingType
    LCM: comfy_extras.nodes_model_advanced.LCM,
AttributeError: module 'comfy_extras' has no attribute 'nodes_model_advanced'

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved module for custom nodes: module 'comfy_extras' has no attribute 'nodes_model_advanced'
Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/__init__.py", line 1, in <module>
    from .videohelpersuite.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/videohelpersuite/nodes.py", line 15, in <module>
    from .image_latent_nodes import *
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/videohelpersuite/image_latent_nodes.py", line 6, in <module>
    from .utils import BIGMIN, BIGMAX
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/videohelpersuite/utils.py", line 101, in <module>
    prompt_queue = server.PromptServer.instance.prompt_queue
AttributeError: partially initialized module 'comfy.cmd.server' has no attribute 'PromptServer' (most likely due to a circular import)

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite module for custom nodes: partially initialized module 'comfy.cmd.server' has no attribute 'PromptServer' (most likely due to a circular import)
FizzleDorf Custom Nodes: Loaded
[tinyterraNodes] Loaded
### Loading: ComfyUI-Manager (V2.8.3)
### ComfyUI Revision: UNKNOWN (The currently installed ComfyUI is not a Git repository)
[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.
### ComfyUI-Manager: Copy .js from '/home/rix/ComfyUI/custom_nodes/ComfyUI-Manager/js/comfyui-manager.js' to '/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/cmd/web/extensions/comfyui-manager'
Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Manager/__init__.py", line 809, in <module>
    @server.PromptServer.instance.routes.get("/customnode/getmappings")
AttributeError: partially initialized module 'comfy.cmd.server' has no attribute 'PromptServer' (most likely due to a circular import)

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-Manager module for custom nodes: partially initialized module 'comfy.cmd.server' has no attribute 'PromptServer' (most likely due to a circular import)
### Loading: ComfyUI-Inspire-Pack (V0.65.5)
Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Inspire-Pack/__init__.py", line 33, in <module>
    imported_module = importlib.import_module(".inspire.{}".format(module_name), __name__)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Inspire-Pack/inspire/lora_block_weight.py", line 10, in <module>
    from server import PromptServer
ImportError: cannot import name 'PromptServer' from partially initialized module 'comfy.cmd.server' (most likely due to a circular import) (/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/cmd/server.py)

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-Inspire-Pack module for custom nodes: cannot import name 'PromptServer' from partially initialized module 'comfy.cmd.server' (most likely due to a circular import) (/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/cmd/server.py)
### Loading: ComfyUI-Impact-Pack (V4.80.1)
### ComfyUI-Impact-Pack: Reinstall dependencies (several dependencies are missing.)
### ComfyUI-Impact-Pack: Check dependencies
### ComfyUI-Impact-Pack: Updating subpack
[Impact Pack] EXECUTE: ['/home/rix/ComfyUI/venv/bin/python3', 'install.py'] in '/home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/impact_subpack'
Traceback (most recent call last):
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/impact_subpack/install.py", line 10, in <module>
    import folder_paths
ModuleNotFoundError: No module named 'folder_paths'
req_path: /home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/impact_subpack/requirements.txt
req_path: /home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/impact_subpack/requirements.txt
req_path: /home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/requirements.txt
### ComfyUI-Impact-Pack: Check basic models
Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/__init__.py", line 72, in <module>
    import impact.impact_server  # to load server api
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/modules/impact/impact_server.py", line 13, in <module>
    import impact.core as core
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/modules/impact/core.py", line 11, in <module>
    from server import PromptServer
ImportError: cannot import name 'PromptServer' from partially initialized module 'comfy.cmd.server' (most likely due to a circular import) (/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/cmd/server.py)

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack module for custom nodes: cannot import name 'PromptServer' from partially initialized module 'comfy.cmd.server' (most likely due to a circular import) (/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/cmd/server.py)

Import times for custom nodes:
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI-Logic
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/style_aligned_comfy
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI-BRIA_AI-RMBG
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/comfyui_controlnet_aux
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/masquerade-nodes-comfyui
   0.0 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet
   0.0 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI-Inspire-Pack
   0.0 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/Derfuu_ComfyUI_ModdedNodes
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/steerable-motion
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI_essentials
   0.0 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI_Comfyroll_CustomNodes
   0.0 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI-Manager
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI-RAFT
   0.0 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite
   0.1 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI_FizzNodes
   0.2 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI-InstantID
   0.4 seconds: /home/rix/ComfyUI/custom_nodes/efficiency-nodes-comfyui
   0.4 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI_tinyterraNodes
   0.9 seconds: /home/rix/ComfyUI/custom_nodes/was-node-suite-comfyui
   1.8 seconds: /home/rix/ComfyUI/custom_nodes/comfyui_segment_anything
   1.8 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI-DragNUWA
   2.8 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack

Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/__init__.py", line 1, in <module>
    from .adv_control.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/nodes.py", line 7, in <module>
    from .control import load_controlnet, convert_to_advanced, is_advanced_controlnet
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet/adv_control/control.py", line 11, in <module>
    from model_patcher import ModelPatcher
ModuleNotFoundError: No module named 'model_patcher'

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet module for custom nodes: No module named 'model_patcher'
------------------------------------------
Comfyroll Studio v1.76 :  175 Nodes Loaded
------------------------------------------
** For changes, please see patch notes at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/blob/main/Patch_Notes.md
** For help, please see the wiki at https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes/wiki
------------------------------------------
Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/__init__.py", line 3, in <module>
    from .animatediff.utils_model import get_available_motion_models, Folders
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/utils_model.py", line 34, in <module>
    class ModelSamplingType:
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/utils_model.py", line 45, in ModelSamplingType
    LCM: comfy_extras.nodes_model_advanced.LCM,
AttributeError: module 'comfy_extras' has no attribute 'nodes_model_advanced'

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved module for custom nodes: module 'comfy_extras' has no attribute 'nodes_model_advanced'
Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/__init__.py", line 1, in <module>
    from .videohelpersuite.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/videohelpersuite/nodes.py", line 15, in <module>
    from .image_latent_nodes import *
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/videohelpersuite/image_latent_nodes.py", line 6, in <module>
    from .utils import BIGMIN, BIGMAX
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite/videohelpersuite/utils.py", line 101, in <module>
    prompt_queue = server.PromptServer.instance.prompt_queue
AttributeError: type object 'PromptServer' has no attribute 'instance'

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite module for custom nodes: type object 'PromptServer' has no attribute 'instance'
FizzleDorf Custom Nodes: Loaded
### Loading: ComfyUI-Manager (V2.8.3)
### ComfyUI Revision: UNKNOWN (The currently installed ComfyUI is not a Git repository)
[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.
### ComfyUI-Manager: Copy .js from '/home/rix/ComfyUI/custom_nodes/ComfyUI-Manager/js/comfyui-manager.js' to '/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/cmd/web/extensions/comfyui-manager'
Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Manager/__init__.py", line 809, in <module>
    @server.PromptServer.instance.routes.get("/customnode/getmappings")
AttributeError: type object 'PromptServer' has no attribute 'instance'

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-Manager module for custom nodes: type object 'PromptServer' has no attribute 'instance'
### Loading: ComfyUI-Inspire-Pack (V0.65.5)
Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Inspire-Pack/__init__.py", line 33, in <module>
    imported_module = importlib.import_module(".inspire.{}".format(module_name), __name__)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Inspire-Pack/inspire/inspire_server.py", line 14, in <module>
    @server.PromptServer.instance.routes.get("/inspire/prompt_builder")
AttributeError: type object 'PromptServer' has no attribute 'instance'

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-Inspire-Pack module for custom nodes: type object 'PromptServer' has no attribute 'instance'
### Loading: ComfyUI-Impact-Pack (V4.80.1)
### Loading: ComfyUI-Impact-Pack (Subpack: V0.4)
Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/__init__.py", line 72, in <module>
    import impact.impact_server  # to load server api
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/modules/impact/impact_server.py", line 27, in <module>
    @server.PromptServer.instance.routes.post("/upload/temp")
AttributeError: type object 'PromptServer' has no attribute 'instance'

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack module for custom nodes: type object 'PromptServer' has no attribute 'instance'

Import times for custom nodes:
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI-Logic
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI_essentials
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/steerable-motion
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/comfyui_segment_anything
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI-DragNUWA
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI-BRIA_AI-RMBG
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/was-node-suite-comfyui
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/masquerade-nodes-comfyui
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/Derfuu_ComfyUI_ModdedNodes
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/efficiency-nodes-comfyui
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI-RAFT
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI-InstantID
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/style_aligned_comfy
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI_FizzNodes
   0.0 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/comfyui_controlnet_aux
   0.0 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI-Advanced-ControlNet
   0.0 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI-Manager
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI_Comfyroll_CustomNodes
   0.0 seconds: /home/rix/ComfyUI/custom_nodes/ComfyUI_tinyterraNodes
   0.0 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI-Inspire-Pack
   0.0 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite
   6.1 seconds (IMPORT FAILED): /home/rix/ComfyUI/custom_nodes/ComfyUI-Impact-Pack

Starting server

To see the GUI go to: http://127.0.0.1:8188
iRohith commented 5 months ago

Fixed some import errors. One error remaining with ComfyUI-AnimateDiff-Evolved custom node. I need to test if nodes are actually working

Traceback (most recent call last):
  File "/home/rix/ComfyUI/venv/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/__init__.py", line 3, in <module>
    from .animatediff.utils_model import get_available_motion_models, Folders
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/utils_model.py", line 34, in <module>
    class ModelSamplingType:
  File "/home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved/animatediff/utils_model.py", line 45, in ModelSamplingType
    LCM: comfy_extras.nodes_model_advanced.LCM,
AttributeError: module 'comfy_extras' has no attribute 'nodes_model_advanced'

Cannot import /home/rix/ComfyUI/custom_nodes/ComfyUI-AnimateDiff-Evolved module for custom nodes: module 'comfy_extras' has no attribute 'nodes_model_advanced'
doctorpangloss commented 5 months ago

I'll resolve these tomorrow, thanks for testing everything for me.

The underlying issue is that I moved some files around, and the custom nodes are looking for them in places they no longer exist.

To mitigate this, the names of imported files are monkey-patched in for the purposes of importing custom nodes.

Once all the names have been added - and all the ways and names that the packages use have been addressed - the errors should go away.

The PromptServer error is more interesting and I have to understand why it's talking about partially imported packages. I believe that the PromptServer is imported after the nodes are by default, which can cause some issues. That could be manifesting a real bug in the nodes, and would probably explain issues where people see "red" nodes before refreshing the page.

iRohith commented 5 months ago

Few things to consider on how I resolved these issues:

1) ComfyUI adds 'comfy' directory to sys.path. So adding modules under 'comfy' module to sys.modules in mitigated_import_of_vanilla_custom_nodes fixed some issues.

2) ComfyUI loads base nodes first and custom nodes after initializing PrompServer. So in package.py import_all_nodes_in_workspace can be separated into two functions to load only base nodes first and load custom nodes after initializing PrompServer.

3) I guess putting nodes = import_all_nodes_in_workspace() at the end of server.py instead of beginning fixed the circular import and also double importing of nodes

Take a look at my fork if you need: https://github.com/iRohith/ComfyUI

doctorpangloss commented 5 months ago

thanks for these changes and for investigating the issue so thoroughy, I'll merge them tomorrow. It was always my intention to support "vanilla" custom nodes, while I have been porting nodes to use setup.py with entrypoints separately.

spideranged commented 5 months ago

i think im having a similar issue... at least part of it.

Python executable: /opt/conda/bin/python3.10 ** Log path: /home/jnkade/comfyui.log

Prestartup times for custom nodes: 0.0 seconds: /home/jrkinkade/custom_nodes/ComfyUI-Manager

Total VRAM 22518 MB, total RAM 16008 MB Set vram state to: NORMAL_VRAM Device: cuda:0 NVIDIA L4 : cudaMallocAsync VAE dtype: torch.bfloat16 Using pytorch cross attention

Loading: ComfyUI-Manager (V2.8.3)

ComfyUI Revision: UNKNOWN (The currently installed ComfyUI is not a Git repository)

[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.

ComfyUI-Manager: Copy .js from '/home/jnkade/custom_nodes/ComfyUI-Manager/js/comfyui-manager.js' to '/opt/conda/lib/python3.10/site-packages/comfy/cmd/web/extensions/comfyui-manager'

Traceback (most recent call last): File "/opt/conda/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1 module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/home/jnkade/custom_nodes/ComfyUI-Manager/init.py", line 809, in @server.PromptServer.instance.routes.get("/customnode/getmappings") AttributeError: partially initialized module 'comfy.cmd.server' has no attribute 'PromptServer' (most likely due to a circular import)

Cannot import /home/jnkade/custom_nodes/ComfyUI-Manager module for custom nodes: partially initialized module 'comfy.cmd.server' has no attribute 'PromptServer' (most likely due to a circular import)

Import times for custom nodes: 0.0 seconds (IMPORT FAILED): /home/jrkinkade/custom_nodes/ComfyUI-Manager

Loading: ComfyUI-Manager (V2.8.3)

ComfyUI Revision: UNKNOWN (The currently installed ComfyUI is not a Git repository)

[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.

ComfyUI-Manager: Copy .js from '/home/jnkade/custom_nodes/ComfyUI-Manager/js/comfyui-manager.js' to '/opt/conda/lib/python3.10/site-packages/comfy/cmd/web/extensions/comfyui-manager'

Traceback (most recent call last): File "/opt/conda/lib/python3.10/site-packages/comfy/nodes/vanilla_node_importing.py", line 30, in _vanilla_load_custom_nodes_1 module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/home/jnkade/custom_nodes/ComfyUI-Manager/init.py", line 809, in @server.PromptServer.instance.routes.get("/customnode/getmappings") AttributeError: type object 'PromptServer' has no attribute 'instance'

Cannot import /home/jnkade/custom_nodes/ComfyUI-Manager module for custom nodes: type object 'PromptServer' has no attribute 'instance'

Import times for custom nodes: 0.0 seconds (IMPORT FAILED): /home/jnkade/custom_nodes/ComfyUI-Manager

Starting server

To see the GUI go to:

doctorpangloss commented 5 months ago

Few things to consider on how I resolved these issues:

1. ComfyUI adds 'comfy' directory to sys.path. So adding modules under 'comfy' module to sys.modules in mitigated_import_of_vanilla_custom_nodes fixed some issues.

2. ComfyUI loads base nodes first and custom nodes after initializing PrompServer. So in package.py import_all_nodes_in_workspace can be separated into two functions to load only base nodes first and load custom nodes after initializing PrompServer.

3. I guess putting nodes = import_all_nodes_in_workspace() at the end of server.py instead of beginning fixed the circular import and also double importing of nodes

Take a look at my fork if you need: https://github.com/iRohith/ComfyUI

I was going to do this now, but I see that your repo has gone private.

iRohith commented 5 months ago

Sorry about that. Updated now. Fixed importing vanilla nodes except ComfyUI-Manager with your latest changes. Please handle web extensions. I am not sure how they actually work. When importing custom nodes some web files are being placed in current directory and some in installed comfyui web directory. I did not test if vanilla custom nodes actually work when running. Only successful import tested

doctorpangloss commented 5 months ago

When importing custom nodes some web files are being placed in current directory and some in installed comfyui web directory. I did not test if vanilla custom nodes actually work when running. Only successful import tested

thanks, will do, I inferred the changes from what you shared. I'll keep cranking at it

doctorpangloss commented 5 months ago

The web extensions are really annoying but nothing I can't figure out :)

Your comfy/nodes/__init__.py is probably the most impactful for fixing issues thanks for investigating that.

doctorpangloss commented 4 months ago

I have started the long journey with ComfyUI-Manager and there's a big slog ahead. I appreciate your patience. I need to research a better way to patch these packages, probably by using mocking.

doctorpangloss commented 4 months ago

I think it would be easiest to reimplement comfyui-manager's backend functionality, rather than try to patch it with code. that means reusing its UI and its lists of nodes. what behavior in it do you actually care about?