Fannovel16/comfy_controlnet_preprocessors

An error occurred while running Python install.py, prompting 'ModuleNotFoundError: No module named' cli_ args'

aipman opened this issue · 5 comments

An error occurred while running Python install.py, prompting 'ModuleNotFoundError: No module named' cli_ args',But this file exists,
image

me too, same problem

...
Requirement already satisfied: mpmath>=0.19 in c:\users\baret\appdata\roaming\python\python310\site-packages (from sympy->torch>=1.7->timm==0.6.12->-r C:\Users\BARET\Desktop\App\ComfyUI\custom_nodes\comfy_controlnet_preprocessors/requirements.txt (line 3)) (1.3.0)
Traceback (most recent call last):
  File "C:\Users\BARET\Desktop\App\ComfyUI\custom_nodes\comfy_controlnet_preprocessors\install.py", line 38, in <module>
    add_global_shortcut_module("model_management", os.path.join(EXT_PATH, "../../comfy/model_management.py"))
  File "C:\Users\BARET\Desktop\App\ComfyUI\custom_nodes\comfy_controlnet_preprocessors\install.py", line 20, in add_global_shortcut_module
    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 "C:\Users\BARET\Desktop\App\ComfyUI\custom_nodes\comfy_controlnet_preprocessors\../../comfy/model_management.py", line 3, in <module>
    from cli_args import args
ModuleNotFoundError: No module named 'cli_args'
PS C:\Users\BARET\Desktop\App\ComfyUI\custom_nodes\comfy_controlnet_preprocessors>

Further running python.exe -m pip install cli_args (with the path to embedded python) installs it, but then gives another error:

Traceback (most recent call last):
  File "O:\Workspace\ImageGenerationAIs\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfy_controlnet_preprocessors\install.py", line 38, in <module>
    add_global_shortcut_module("model_management", os.path.join(EXT_PATH, "../../comfy/model_management.py"))
  File "O:\Workspace\ImageGenerationAIs\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfy_controlnet_preprocessors\install.py", line 20, in add_global_shortcut_module
    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 "O:\Workspace\ImageGenerationAIs\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfy_controlnet_preprocessors\../../comfy/model_management.py", line 3, in <module>
    from cli_args import args
ImportError: cannot import name 'args' from 'cli_args' (O:\Workspace\ImageGenerationAIs\ComfyUI_windows_portable\python_embeded\lib\site-packages\cli_args\__init__.py)

Okay, apparently it's a local module, and something breaks inside install.py, it seems like it might not be loading it in the right working directory or something along those lines.

Just to try something I tried wrapping add_global_shortcut_module into try-except, it got further and then failed to import cv2. And it looks like it's trying to install things into the system python instead of the embedded one. Even if running O:\Workspace\ImageGenerationAIs\ComfyUI_windows_portable\python_embeded\python.exe .\install.py

I think os.system line that installs requirements.txt should include path to embedded interpreter, at least for portable windows installer of Comfy: os.system(f'O:\Workspace\ImageGenerationAIs\ComfyUI_windows_portable\python_embeded\python.exe -m pip install -r "{EXT_PATH}/requirements.txt" --extra-index-url https://download.pytorch.org/whl/cu117 --no-warn-script-location') (well, reworked properly with variables and now hardcoded path like here)

I confirm if we place the comfyui-impact-pack.py file in the root of \custom_nodes everything works, but it would be nice if we could run it in its git folder

@Nixellion Mine is the same, I tried for a long time and it didn’t work. [I tried to move cli_args or modify the configuration in comfyUI, but it still reported ImportError: cannot import name ‘args’ from ‘cli_args’

Have you all solved it? I can’t figure it out and it’s very uncomfortable