ImportError: cannot import name 'init_custom_nodes' from 'nodes'
gopi77 opened this issue · comments
PS D:\project\GenAI\ComfyUI\ComfyUI-to-Python-Extension> python .\comfyui_to_python.py
Total VRAM 8192 MB, total RAM 16315 MB
pytorch version: 2.3.0+cu121
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce GTX 1070 : native
Using pytorch cross attention
Traceback (most recent call last):
File "D:\project\GenAI\ComfyUI\ComfyUI-to-Python-Extension\comfyui_to_python.py", line 460, in
ComfyUItoPython(input_file=input_file, output_file=output_file, queue_size=queue_size)
File "D:\project\GenAI\ComfyUI\ComfyUI-to-Python-Extension\comfyui_to_python.py", line 425, in init
self.execute()
File "D:\project\GenAI\ComfyUI\ComfyUI-to-Python-Extension\comfyui_to_python.py", line 434, in execute
import_custom_nodes()
File "D:\project\GenAI\ComfyUI\ComfyUI-to-Python-Extension\utils.py", line 16, in import_custom_nodes
from nodes import init_custom_nodes
ImportError: cannot import name 'init_custom_nodes' from 'nodes' (D:\project\GenAI\ComfyUI\ComfyUI-to-Python-Extension..\nodes.py). Did you mean: 'init_extra_nodes'?
I noticed few discussion on this issue. But couldn't find a fixed and working code.
So, Please update the fix to the latest code.
Updated the first few lines of comfyui_to_python.py with below changes & made it working.
import copy
import glob
import inspect
import json
import os
import random
import sys
import re
from typing import Dict, List, Any, Callable, Tuple
import black
from utils import find_path, add_comfyui_directory_to_sys_path, add_extra_model_paths, get_value_at_index
sys.path.append('../')
from nodes import NODE_CLASS_MAPPINGS, init_builtin_extra_nodes, init_external_custom_nodes