Kosinkadink / ComfyUI-Advanced-ControlNet

ControlNet scheduling and masking nodes with sliding context support
GNU General Public License v3.0
435 stars 43 forks source link

ModuleNotFoundError: No module named 'model_patcher' #85

Closed AssassinsLament closed 3 months ago

AssassinsLament commented 3 months ago

Traceback (most recent call last): File "D:\DEVELOPMENT\AI\ART\ComfyUI\nodes.py", line 1885, in load_custom_node module_spec.loader.exec_module(module) File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "D:\DEVELOPMENT\AI\ART\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet__init__.py", line 1, in from .adv_control.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS File "D:\DEVELOPMENT\AI\ART\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet\adv_control\nodes.py", line 7, in from .control import load_controlnet, convert_to_advanced, is_advanced_controlnet File "D:\DEVELOPMENT\AI\ART\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet\adv_control\control.py", line 11, in from model_patcher import ModelPatcher ModuleNotFoundError: No module named 'model_patcher'

Cannot import D:\DEVELOPMENT\AI\ART\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet module for custom nodes: No module named 'model_patcher'

--

0.0 seconds (IMPORT FAILED): D:\DEVELOPMENT\AI\ART\ComfyUI\custom_nodes\ComfyUI-Advanced-ControlNet

Everything was working fine last night, and after I updated all this morning, I get this. Searched and found that it can be "fixed" by changing:

in control.py

from model_patcher import ModelPatcher

to:

from comfy.model_patcher import ModelPatcher

Not sure if this break anything else. Would love to figure out what broke this in the first place. Only "ComfyUI-Advanced-ControlNet" is unable to import.

Kosinkadink commented 3 months ago

Thanks for the heads up, in certain environments python gets confused and requires that files in the comfy folder require the 'comfy.' prefix, so I've been making sure to include it. Unfortunately, sometimes it still slips through the cracks as my IDE works fine without the prefix, so if I trust the IDE to automatically make the import code, it will not include the prefix. I must have forgotten to manually fix it.

I'll merge a change shortly to add the 'comfy.' to fix the issue.

AssassinsLament commented 3 months ago

Thanks for the heads up, in certain environments python gets confused and requires that files in the comfy folder require the 'comfy.' prefix, so I've been making sure to include it. Unfortunately, sometimes it still slips through the cracks as my IDE works fine without the prefix, so if I trust the IDE to automatically make the import code, it will not include the prefix. I must have forgotten to manually fix it.

I'll merge a change shortly to add the 'comfy.' to fix the issue.

but but... it was working fine yesterday lol, I checked your updates and didn't see that code change at all. scratches head lol, thanks!

Kosinkadink commented 3 months ago

Im not sure what the cause is of python not liking that import statement, so it's possible something else in the python environment changed that caused the import to no longer work (which is why I do my best to catch these before I merge into main lol)

laidingq commented 3 months ago

I just updated comfyui and a few plugins, and the same problem occurred. I have been using it normally before

Kosinkadink commented 3 months ago

It should be fixed now if you update Advanced-ControlNet - let me know if it works/doesn't work after update!

laidingq commented 3 months ago

It can now be loaded normally. Thank you