ComfyUI-IDM-VTON icon indicating copy to clipboard operation
ComfyUI-IDM-VTON copied to clipboard

ModuleNotFoundError: No module named 'folder_paths'

Open suanow opened this issue 1 year ago • 8 comments

Hi! I try to run the flow on google cloud vm, but when running python install.py i face this issue:

comfyvm:~/ComfyUI/custom_nodes/ComfyUI-IDM-VTON$ python install.py Traceback (most recent call last): File "/home/suanow/ComfyUI/custom_nodes/ComfyUI-IDM-VTON/install.py", line 6, in from folder_paths import models_dir ModuleNotFoundError: No module named 'folder_paths'

Any ideas on how to fix it? all other things ive tried to run (not connected to IDM-VTON) does not have this issue. Thanks in advance

suanow avatar Aug 18 '24 14:08 suanow

Hi, I think install.py should be run from the root of ComfyUI. Can you try moving to the root dir and run something like:

python custom_nodes/ComfyUI-IDM-VTON/install.py

Let me know if that works.

TemryL avatar Aug 18 '24 15:08 TemryL

if i understand you properly, i've cd'ed to ComfyUI dir and run the command. However, the issue is still the same

Command from term: ~/ComfyUI$ python custom_nodes/ComfyUI-IDM-VTON/install.py Error: Traceback (most recent call last): File "/home/suanow/ComfyUI/custom_nodes/ComfyUI-IDM-VTON/install.py", line 6, in from folder_paths import models_dir ModuleNotFoundError: No module named 'folder_paths'

UPD: btw for some reason trying to fix this with manager does not end despite the node itself being showed not as missing :/

And the main error i see in the ComfyUI when running flow is this: Error occurred when executing PipelineLoader:

Error no file named scheduler_config.json found in directory /home/suanow/ComfyUI/models/IDM-VTON.

File "/home/suanow/ComfyUI/execution.py", line 316, in execute output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) File "/home/suanow/ComfyUI/execution.py", line 191, in get_output_data return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) File "/home/suanow/ComfyUI/execution.py", line 168, in _map_node_over_list process_inputs(input_dict, i) File "/home/suanow/ComfyUI/execution.py", line 157, in process_inputs results.append(getattr(obj, func)(**inputs)) File "/home/suanow/ComfyUI/custom_nodes/ComfyUI-IDM-VTON/src/nodes/pipeline_loader.py", line 41, in load_pipeline noise_scheduler = DDPMScheduler.from_pretrained( File "/home/suanow/miniconda3/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "/home/suanow/miniconda3/lib/python3.10/site-packages/diffusers/schedulers/scheduling_utils.py", line 143, in from_pretrained config, kwargs, commit_hash = cls.load_config( File "/home/suanow/miniconda3/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "/home/suanow/miniconda3/lib/python3.10/site-packages/diffusers/configuration_utils.py", line 374, in load_config raise EnvironmentError(

suanow avatar Aug 18 '24 15:08 suanow

Hey @WAS-PlaiLabs, I think your last PR broke the install. Could you tell us how install.pyshould be run (as it import folder_paths from comfyui) and maybe update the readme if you have some times? Thanks!

TemryL avatar Aug 18 '24 17:08 TemryL

The install will probably need add ComfyUI base to sys paths in order to import it's folder management module.

Will take a look as soon as I am home.

WASasquatch avatar Aug 18 '24 18:08 WASasquatch

Yeah I believe all that's needed is to add to sys path, just backup two directories since we don't know users system: sys.path.append('../../') added before the import https://github.com/TemryL/ComfyUI-IDM-VTON/blob/main/install.py#L5

I can make a PR when I am home if need be but should be simple fix. I actually assumed this install was ran within ComfyUI -- in fact you may think about doing that. Use the startup_script.py file which runs before ComfyUI starts. If using Manager you wouldn't have to worry about installing requirements, just downloading weights to the folder.

WASasquatch avatar Aug 18 '24 19:08 WASasquatch

TY, wil try to fix this. I was having the same issue with manager some time before, but was fixing it with deleting and redownloading the node in "missing node". However, now the manager does not allow me to fix it somehow.

thanks once again for helping!

suanow avatar Aug 18 '24 19:08 suanow

You can modify the install.py file to comment out folder_paths and change them to the absolute paths of models/IDM-VTON

from folder_paths import models_dir

models_dir= "/opt/xx/ComfyUI/models/"

Y-ujl avatar Aug 19 '24 08:08 Y-ujl

https://github.com/TemryL/ComfyUI-IDM-VTON/pull/73

WAS-PlaiLabs avatar Aug 19 '24 15:08 WAS-PlaiLabs

import sys import os import subprocess from huggingface_hub import snapshot_download

sys.path.append("../../") '# from folder_paths import models_dir

CUSTOM_NODES_PATH = os.path.dirname(os.path.abspath(file)) '# WEIGHTS_PATH = os.path.join(models_dir, "IDM-VTON") WEIGHTS_PATH = "C:\DEV\ComfyUI\custom_nodes\ComfyUI-IDM-VTON\models/IDM-VTON" HF_REPO_ID = "yisol/IDM-VTON"

lkylove avatar Feb 18 '25 16:02 lkylove