ltdrdata / ComfyUI-Impact-Pack

Custom nodes pack for ComfyUI This custom node helps to conveniently enhance images through Detector, Detailer, Upscaler, Pipe, and more.
GNU General Public License v3.0
1.87k stars 179 forks source link

IMPORT FAILED - ModuleNotFoundError: No module named 'ultralytics' #793

Open DigiClau opened 1 week ago

DigiClau commented 1 week ago

This issue just happend today. I noticed there were similar issues here, but my case is with ModuleNotFoundError: No module named 'ultralytics' I re-installed ComfyUI with only Impact-Pack custome node with ComfyUI-Manager. Clean install but still the same issue occurs. Any help will be greatly appreciated. I am using the Colab notebook included in the ComfyUI Manager repo. Below is the error messages...

No module named 'ultralytics'

!!!!!

[ComfyUI-Impact-Subpack] If this error occurs, please check the following link: https://github.com/ltdrdata/ComfyUI-Impact-Pack/blob/Main/troubleshooting/TROUBLESHOOTING.md

!!!!!

[Impact Pack] Failed to import due to several dependencies are missing!!!! Traceback (most recent call last): File "/content/drive/MyDrive/ComfyUI/nodes.py", line 2001, in load_custom_node module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/content/drive/MyDrive/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/init.py", line 53, in raise e File "/content/drive/MyDrive/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/init.py", line 31, in import impact.subpack_nodes # This import must be done before cv2. File "/content/drive/MyDrive/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/impact_subpack/impact/subpack_nodes.py", line 4, in import impact.subcore as subcore File "/content/drive/MyDrive/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/impact_subpack/impact/subcore.py", line 17, in raise e File "/content/drive/MyDrive/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/impact_subpack/impact/subcore.py", line 13, in from ultralytics import YOLO ModuleNotFoundError: No module named 'ultralytics'

DigiClau commented 1 week ago

If I try to fix it in the Manager, it says "security level configuration" 1 2

Actually, it works at first but if I restart Colab and then the Import Failed issues occurs with the error message. it seems that the "ultralytics" module is installed when "Impact Pack" is installed, but the module is uninstalled afterward.

I manually installed "ultralytics" and restarted. It works. No errors. However, if I disconned Colab and open the note again, "ultralytics" is missing. I wonder if I should manually include "ultralytics" in the requirements.txt so that it is properly installed.

UPDATE I additionally installed the ComfyUI-YOLO custom node as it includes "ultralytics" in the requirements.txt file. It guarantees that "ultralytics" is always available on Colab. Butl, I am worried what if ComfyUI-Impact-Pack is installed before ComfyUI-YOLO and fails.

ltdrdata commented 1 week ago

oh... I got it... What is the situation.

DigiClau commented 1 week ago

oh... I got it... What is the situation.

It appears that Colab does not install the ultralytics module by default. When I install the ComfyUI-Impact-Pack and restart while Colab remains connected, ultralytics is present in the environment, and no error occurs. However, if I restart Colab after disconnecting, ultralytics is missing. I believe this happens because ultralytics isn’t included in the requirements.txt file and isn’t installed by Colab automatically.

To address this, I install ComfyUI-YOLO since ultralytics is listed in its requirements.txt. Ideally, ultralytics would be added to the main requirements.txt file of the ComfyUI-Impact-Pack for consistency.

ltdrdata commented 1 week ago

I plan to separate Impact Subpack into a completely independent installation soon or later. When that happens, it will resolve itself naturally.