comfyui-reactor-node icon indicating copy to clipboard operation
comfyui-reactor-node copied to clipboard

AttributeError: module 'cv2.gapi.wip.draw' has no attribute 'Text'

Open johnyaudesign opened this issue 1 year ago • 2 comments

First, confirm

  • [X] I have read the instruction carefully
  • [X] I have searched the existing issues
  • [X] I have updated the extension to the latest version

What happened?

Hello, after multiple tries at reinstalling and trying different solutions I've found in the past few days, I am hoping to get a bit more support on this issue.

After installing ReActor with the ComfyUI Manager, my ControlnetAux module and VideoHelperSuite module have stopped importing.

I've tried just about every suggestion I can get my hand on. I've got opencv_python-4.7.0.72 installed, along with the contrib_python and python_headless of the same version.

When ReActor is removed, controlnet works fine.

Steps to reproduce the problem

I'm trying to have ReActor and controlnet, videohelpersuite all working fine in the same workflow.

Sysinfo

Total VRAM 8192 MB, total RAM 32553 MB xformers version: 0.0.22.post4 Set vram state to: NORMAL_VRAM Device: cuda:0 NVIDIA GeForce RTX 2070 : cudaMallocAsync VAE dtype: torch.float32 Torch version: 2.1.0+cu121

Relevant console log

### Loading: ComfyUI-Manager (V1.7.2)
### ComfyUI Revision: 1822 [a5056cfb] | Released on '2023-12-15'
Total VRAM 8192 MB, total RAM 32553 MB
xformers version: 0.0.22.post4
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 2070 : cudaMallocAsync
VAE dtype: torch.float32
Torch version: 2.1.0+cu121
Traceback (most recent call last):
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\nodes.py", line 1800, in load_custom_node
    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 "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\ComfyUI-VideoHelperSuite\__init__.py", line 1, in <module>
    from .videohelpersuite.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\ComfyUI-VideoHelperSuite\videohelpersuite\nodes.py", line 16, in <module>
    from .load_video_nodes import LoadVideoUpload, LoadVideoPath
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\ComfyUI-VideoHelperSuite\videohelpersuite\load_video_nodes.py", line 5, in <module>
    import cv2
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\venv\lib\site-packages\cv2\__init__.py", line 181, in <module>
    bootstrap()
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\venv\lib\site-packages\cv2\__init__.py", line 175, in bootstrap
    if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\venv\lib\site-packages\cv2\__init__.py", line 28, in __load_extra_py_code_for_module
    py_module = importlib.import_module(module_name)
  File "importlib\__init__.py", line 126, in import_module
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\venv\lib\site-packages\cv2\typing\__init__.py", line 157, in <module>
    Prim = typing.Union[cv2.gapi.wip.draw.Text, cv2.gapi.wip.draw.Circle, cv2.gapi.wip.draw.Image, cv2.gapi.wip.draw.Line, cv2.gapi.wip.draw.Rect, cv2.gapi.wip.draw.Mosaic, cv2.gapi.wip.draw.Poly]
AttributeError: module 'cv2.gapi.wip.draw' has no attribute 'Text'

Cannot import G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\ComfyUI-VideoHelperSuite module for custom nodes: module 'cv2.gapi.wip.draw' has no attribute 'Text'
Traceback (most recent call last):
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\nodes.py", line 1800, in load_custom_node
    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 "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\comfyui_controlnet_aux\__init__.py", line 2, in <module>
    from .utils import here, create_node_input_types
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\comfyui_controlnet_aux\utils.py", line 4, in <module>
    import cv2
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\venv\lib\site-packages\cv2\__init__.py", line 181, in <module>
    bootstrap()
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\venv\lib\site-packages\cv2\__init__.py", line 175, in bootstrap
    if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\venv\lib\site-packages\cv2\__init__.py", line 28, in __load_extra_py_code_for_module
    py_module = importlib.import_module(module_name)
  File "importlib\__init__.py", line 126, in import_module
  File "G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\venv\lib\site-packages\cv2\typing\__init__.py", line 157, in <module>
    Prim = typing.Union[cv2.gapi.wip.draw.Text, cv2.gapi.wip.draw.Circle, cv2.gapi.wip.draw.Image, cv2.gapi.wip.draw.Line, cv2.gapi.wip.draw.Rect, cv2.gapi.wip.draw.Mosaic, cv2.gapi.wip.draw.Poly]
AttributeError: module 'cv2.gapi.wip.draw' has no attribute 'Text'

Cannot import G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\comfyui_controlnet_aux module for custom nodes: module 'cv2.gapi.wip.draw' has no attribute 'Text'
Efficiency Nodes: Attempting to add Control Net options to the 'HiRes-Fix Script' Node (comfyui_controlnet_aux add-on)...Failed!

[rgthree] Loaded 20 exciting nodes.
[rgthree] Optimizing ComfyUI recursive execution. If queueing and/or re-queueing seems broken, change "patch_recursive_execution" to false in rgthree_config.json 


Import times for custom nodes:
   0.0 seconds: G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\image-resize-comfyui
   0.0 seconds: G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\ComfyUI-Frame-Interpolation
   0.0 seconds: G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\ComfyUI_UltimateSDUpscale
   0.0 seconds: G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\rgthree-comfy
   0.0 seconds (IMPORT FAILED): G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\ComfyUI-VideoHelperSuite
   0.0 seconds (IMPORT FAILED): G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\comfyui_controlnet_aux
   0.1 seconds: G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\efficiency-nodes-comfyui
   0.2 seconds: G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\ComfyUI-Manager-main
   1.1 seconds: G:\John\Projects\2D\AI\StabilityMatrix-win-x64\Data\Packages\ComfyUI\custom_nodes\comfyui-reactor-node

Additional information

No response

johnyaudesign avatar Dec 15 '23 19:12 johnyaudesign

Hello Try this solution https://github.com/Gourieff/comfyui-reactor-node#iv-controlnet-aux-node-import-failed-error-when-using-with-reactor-node

I've got opencv_python-4.7.0.72 installed, along with the contrib_python and python_headless of the same version.

It's more appropriate to have only one OpenCV inside the enclosure, but not all its versions

Gourieff avatar Dec 16 '23 04:12 Gourieff

how to resolve?

dolearndouble avatar Jan 29 '24 10:01 dolearndouble