toyxyz / ComfyUI_toyxyz_test_nodes

Custom node and script for sending webcam to ComfyUI
GNU General Public License v3.0
460 stars 29 forks source link

No module named 'cv2' #23

Closed mflux closed 6 months ago

mflux commented 6 months ago

I've updated ComfyUI to the latest as of writing. Git cloned this repo into ComfyUI/custom_nodes correctly into the subfolder, then ran CaptureCam/setup.bat

Upon starting ComfyUI I get Traceback (most recent call last): File "C:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1800, 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 "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_toyxyz_test_nodes__init__.py", line 12, in imported_module = importlib.import_module(".{}".format(module_name), name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "importlib__init__.py", line 126, in import_module File "", line 1204, in _gcd_import File "", line 1176, in _find_and_load File "", line 1147, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_toyxyz_test_nodes\toyxyz_test_nodes.py", line 8, in import cv2 ModuleNotFoundError: No module named 'cv2'

Cannot import C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_toyxyz_test_nodes module for custom nodes: No module named 'cv2'

toyxyz commented 6 months ago

The cv2 module is not installed. You can install it manually in ComfyUI. If it's portable version, run this command from that path.

python_embeded\python.exe -m pip install opencv-python

mflux commented 6 months ago

Thanks, I figured I had to do that. Would be great to write that into the instruction or script it into the installation for future people who get snagged on this.