cubiq / ComfyUI_InstantID

Apache License 2.0
944 stars 50 forks source link

Import Failed #132

Open AWMANW opened 2 months ago

AWMANW commented 2 months ago

After I installed IstantID, it meet following error,how to solve it?

Traceback (most recent call last): File "D:\Programes\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1889, 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:\Programes\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_InstantID__init__.py", line 1, in from .InstantID import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS File "D:\Programes\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_InstantID\InstantID.py", line 7, in import cv2 ModuleNotFoundError: No module named 'cv2'

Cannot import D:\Programes\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_InstantID module for custom nodes: No module named 'cv2'

Import times for custom nodes: 0.0 seconds: D:\Programes\ComfyUI_windows_portable\ComfyUI\custom_nodes\websocket_image_save.py 0.0 seconds: D:\Programes\ComfyUI_windows_portable\ComfyUI\custom_nodes\AIGODLIKE-COMFYUI-TRANSLATION 0.0 seconds: D:\Programes\ComfyUI_windows_portable\ComfyUI\custom_nodes\sdxl_prompt_styler 0.0 seconds: D:\Programes\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Custom-Scripts 0.0 seconds: D:\Programes\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-WD14-Tagger 0.0 seconds: D:\Programes\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_UltimateSDUpscale 0.0 seconds (IMPORT FAILED): D:\Programes\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_InstantID 0.6 seconds: D:\Programes\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager 7.3 seconds: D:\Programes\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Custom_Nodes_AlekPet

cubiq commented 2 months ago

you need to install opencv

AWMANW commented 2 months ago

I use the ComfyUI_windows_portable version, I assume every dependices are embeded.

cubiq commented 2 months ago

no, not really. you will also have to install insightface

AWMANW commented 2 months ago

Could please to instruct me how to do it?

IntellectusPrime commented 2 months ago

i have the same problem. everything is installed and up to date. Still import fails

EDIT: i found a solution for me. Somehow my opencv got corrupted. i tried the following and it works:

1)Close ComfyUI if it runs 2)Go to the ComfyUI root folder, open CMD there and run: 3)python_embeded\python.exe -m pip uninstall -y opencv-python opencv-contrib-python opencv-python-headless 4)python_embeded\python.exe -m pip install opencv-python==4.7.0.72

i hope it helps!

ewebgh33 commented 3 weeks ago

I followed the steps from @IntellectusPrime, opened ComfyUI, InstantID (native support) still won't load/import. Uninstalled/reinstalled the custom nodes Same problem, still red, still says can't import.

How do we solve this please? Specifically I am trying to use in the comfyUI workflow from here: https://github.com/fofr/cog-consistent-character?tab=readme-ov-file

EDIT

This solved it for me

https://www.reddit.com/r/comfyui/comments/18ou0ly/installing_insightface/

python_embeded\python.exe -m pip uninstall insightface then download the insightface wheel for 3.11 and python_embeded\python.exe -m pip install insightface-0.7.3-cp311-cp311-win_amd64.whl then reboot comfy