Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "Message class can only inherit from Message" #7

Closed
Miosp opened this issue Aug 19, 2023 · 15 comments
Closed

Error: "Message class can only inherit from Message" #7

Miosp opened this issue Aug 19, 2023 · 15 comments

Comments

@Miosp
Copy link

Miosp commented Aug 19, 2023

I know that this issue also existed in previous version of the extension and i never managed to get it working with methods mentioned earlier, so I'm gonna leave this there.

What I already tried:

  • Do Comfy install in a venv
  • Clean venv and install everything manually
  • Clean install python and reinstall everything

My setup (something might mess things up and that's why it's not working):

  • Pyenv-win (used to manage python versions)
  • venv
  • manual ComfyUI install (via git clone)
  • manual extension install (via install.bat file)

The error:

Full error log from comfyui_controlnet_aux:
Traceback (most recent call last):
  File "C:\AI\ComfyUI\custom_nodes\comfyui_controlnet_aux\__init__.py", line 26, in load_nodes
    module = importlib.import_module(
  File "C:\Users\janlu\.pyenv\pyenv-win\versions\3.10.11\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\AI\ComfyUI\custom_nodes\comfyui_controlnet_aux\node_wrappers\mediapipe_face.py", line 2, in <module>
    from controlnet_aux.mediapipe_face import MediapipeFaceDetector
  File "C:\AI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\mediapipe_face\__init__.py", line 9, in <module>
    from .mediapipe_face_common import generate_annotation
  File "C:\AI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\mediapipe_face\mediapipe_face_common.py", line 5, in <module>
    import mediapipe as mp
  File "C:\AI\ComfyUI\venv\lib\site-packages\mediapipe\__init__.py", line 16, in <module>
    import mediapipe.python.solutions as solutions
  File "C:\AI\ComfyUI\venv\lib\site-packages\mediapipe\python\solutions\__init__.py", line 17, in <module>
    import mediapipe.python.solutions.drawing_styles
  File "C:\AI\ComfyUI\venv\lib\site-packages\mediapipe\python\solutions\drawing_styles.py", line 20, in <module>
    from mediapipe.python.solutions.drawing_utils import DrawingSpec
  File "C:\AI\ComfyUI\venv\lib\site-packages\mediapipe\python\solutions\drawing_utils.py", line 24, in <module>
    from mediapipe.framework.formats import detection_pb2
  File "C:\AI\ComfyUI\venv\lib\site-packages\mediapipe\framework\formats\detection_pb2.py", line 14, in <module>
    from mediapipe.framework.formats import location_data_pb2 as mediapipe_dot_framework_dot_formats_dot_location__data__pb2
  File "C:\AI\ComfyUI\venv\lib\site-packages\mediapipe\framework\formats\location_data_pb2.py", line 14, in <module>
    from mediapipe.framework.formats.annotation import rasterization_pb2 as mediapipe_dot_framework_dot_formats_dot_annotation_dot_rasterization__pb2
  File "C:\AI\ComfyUI\venv\lib\site-packages\mediapipe\framework\formats\annotation\rasterization_pb2.py", line 20, in <module>
    _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'mediapipe.framework.formats.annotation.rasterization_pb2', _globals)
  File "C:\AI\ComfyUI\venv\lib\site-packages\google\protobuf\internal\builder.py", line 108, in BuildTopDescriptorsAndMessages
    module[name] = BuildMessage(msg_des)
  File "C:\AI\ComfyUI\venv\lib\site-packages\google\protobuf\internal\builder.py", line 82, in BuildMessage
    create_dict[name] = BuildMessage(nested_msg)
  File "C:\AI\ComfyUI\venv\lib\site-packages\google\protobuf\internal\builder.py", line 85, in BuildMessage
    message_class = _reflection.GeneratedProtocolMessageType(
TypeError: A Message class can only inherit from Message



[comfyui_controlnet_aux] | STATUS -> Some nodes failed to load:
        Failed to import module mediapipe_face because TypeError: A Message class can only inherit from Message
@G-Grifflu
Copy link

Same here. But Comfy installed via 7zip file and extension via Manager.
Everything at latest version. Updated Comfy and dependencies.

@Fannovel16
Copy link
Owner

@Miosp @G-Grifflu I pushed the fix at 8b7ce6c. Can yall do a git pull?

@Miosp
Copy link
Author

Miosp commented Aug 20, 2023

The error when opening Comfy is gone, but when trying to use the "MediaPipe face mesh preprocessor" this error is generated:

Traceback (most recent call last):
  File "C:\AI\ComfyUI\execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "C:\AI\ComfyUI\execution.py", line 81, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "C:\AI\ComfyUI\execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "C:\AI\ComfyUI\custom_nodes\comfyui_controlnet_aux\node_wrappers\mediapipe_face.py", line 26, in detect
    return (common_annotator_call(MediapipeFaceDetector(), image, max_faces=max_faces, min_confidence=min_confidence), )
  File "C:\AI\ComfyUI\custom_nodes\comfyui_controlnet_aux\utils.py", line 28, in common_annotator_call
    np_result = model(np_image, output_type="np", **kwargs)
  File "C:\AI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\mediapipe_face\__init__.py", line 42, in __call__
    detected_map = generate_annotation(input_image, max_faces, min_confidence)
  File "C:\AI\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\mediapipe_face\mediapipe_face_common.py", line 102, in generate_annotation
    with mp_face_mesh.FaceMesh(
NameError: name 'mp_face_mesh' is not defined

@Fannovel16
Copy link
Owner

@Miosp @G-Grifflu I think the installation of mediapipe might have been wrong. Fixed at f99b09b

@Miosp
Copy link
Author

Miosp commented Aug 21, 2023

That solved all the issues for me

@Miosp Miosp closed this as completed Aug 21, 2023
@kronkinatorix
Copy link

Still getting the error after these on my end.

Running from a venv on linux miunt on its own ssd.

Did a git clone --depth 1 --recurse-submodules --shallow-submodules https://github.com/Fannovel16/comfyui_controlnet_aux
for the rop

tried changing interp=img.LINEAR to img.Bilinear in src/custom_detectron2/data/transforms, same error.

Delted pycache and rebooted - you guessed it.

Added this under the load_custom_nodes() function based on another thread that said the error was due to protobuf loading something twice:

    if 'ComfyUI_roop' in possible_modules:
        possible_modules.remove('ComfyUI_roop')
        possible_modules.append('ComfyUI_roop')
    print(possible_modules)

Bupkis. lemme know if there's anything I can help with to fix it. Not a python expert but I know a wee bit.

@Fannovel16
Copy link
Owner

Fannovel16 commented Aug 31, 2023

@kronkinatorix Roop again 😒. Iirc, one of dependencies from roop installing a different version of protobuf, leading to conflicts with not just this extensions but also others. My extension doesn't make any change to protobuf. But I'll reopen this issue so that there won't be duplicated issues.

As for now, that patch seems to be the only way fix it completely.

@Gourieff
Copy link

@Fannovel16 Hi there!
I found the way to solve the issue when ControlNet Aux doesn't work (import failed) with ReActor node (or any other Roop node) enabled Gourieff/comfyui-reactor-node#45 (comment)
ReActor + ControlNet Aux work great together now (you just need to edit one line in requirements)

@Fannovel16
Copy link
Owner

@Gourieff Is opencv-python 4.7.0.72 compatible with DWPose? A1111 side chooses 4.8.0 (Mikubill/sd-webui-controlnet#1897)

@Fannovel16
Copy link
Owner

Fannovel16 commented Sep 26, 2023

Oh good, it works. Just did a quick test on my weak Windows machine but I think this is the case for other platforms.

Fannovel16 pushed a commit that referenced this issue Dec 9, 2023
@mofos
Copy link

mofos commented Jan 2, 2024

Same issue but with MeshGraphormer-DepthMapPreprocessor now

ERROR:root:!!! Exception during processing !!! ERROR:root:Traceback (most recent call last): File "/workspace/ComfyUI/execution.py", line 154, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "/workspace/ComfyUI/execution.py", line 84, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "/workspace/ComfyUI/execution.py", line 77, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "/workspace/ComfyUI/custom_nodes/comfyui_controlnet_aux/node_wrappers/mesh_graphormer.py", line 55, in execute install_deps() File "/workspace/ComfyUI/custom_nodes/comfyui_controlnet_aux/node_wrappers/mesh_graphormer.py", line 31, in install_deps import mediapipe File "/workspace/ComfyUI/venv/lib/python3.10/site-packages/mediapipe/__init__.py", line 16, in <module> import mediapipe.python.solutions as solutions File "/workspace/ComfyUI/venv/lib/python3.10/site-packages/mediapipe/python/solutions/__init__.py", line 17, in <module> import mediapipe.python.solutions.drawing_styles File "/workspace/ComfyUI/venv/lib/python3.10/site-packages/mediapipe/python/solutions/drawing_styles.py", line 20, in <module> from mediapipe.python.solutions.drawing_utils import DrawingSpec File "/workspace/ComfyUI/venv/lib/python3.10/site-packages/mediapipe/python/solutions/drawing_utils.py", line 24, in <module> from mediapipe.framework.formats import detection_pb2 File "/workspace/ComfyUI/venv/lib/python3.10/site-packages/mediapipe/framework/formats/detection_pb2.py", line 15, in <module> from mediapipe.framework.formats import location_data_pb2 as mediapipe_dot_framework_dot_formats_dot_location__data__pb2 File "/workspace/ComfyUI/venv/lib/python3.10/site-packages/mediapipe/framework/formats/location_data_pb2.py", line 15, in <module> from mediapipe.framework.formats.annotation import rasterization_pb2 as mediapipe_dot_framework_dot_formats_dot_annotation_dot_rasterization__pb2 File "/workspace/ComfyUI/venv/lib/python3.10/site-packages/mediapipe/framework/formats/annotation/rasterization_pb2.py", line 25, in <module> 'Interval' : _reflection.GeneratedProtocolMessageType('Interval', (_message.Message,), { TypeError: A Message class can only inherit from Message

Yes i have Roop installed,
it was working until I updated Comfy UI, and some custom nodes

sdvdsvdsvs
dvdsvdsv

@sd827999094
Copy link

me too ,and my opencv version 4.8.0.76

@mingqizhang
Copy link

@mofos Same issue with MeshGraphormer, did you solve it?

@mofos
Copy link

mofos commented Jan 12, 2024

Nope but my best guess is a dependency conflict from my other custom nodes, my friends were able to get it running. i wish there was a way of identifying conflicts like this. if anyone knows how to do a proper debugging when my custom nodes have conflicts like this, please let me know.

@robinboncoeur
Copy link

robinboncoeur commented Feb 19, 2024

I've encountered the same issue (TypeError: A Message class can only inherit from Message). I've zeroed in on the origin of the message being deep in the venv and related to google.protobuf. The blow-by-blow can be viewed here. Roop - or some variant thereof - is a key module, so I'm reluctant to uninstall it. However, open to suggestions on how to resolve this.

My system:

** ComfyUI startup time: 2024-02-03 10:45:44.687791
** Platform: Linux
** Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
** Python executable: /home/moi/ComfyUI/venv/bin/python3.10
** Log path: /home/moi/ComfyUI/comfyui.log
Prestartup times for custom nodes:
0.0 seconds: /home/moi/ComfyUI/custom_nodes/rgthree-comfy
0.0 seconds: /home/moi/ComfyUI/custom_nodes/ComfyUI-Manager
Total VRAM 16075 MB, total RAM 32003 MB
xformers version: 0.0.22
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4060 Ti : cudaMallocAsync
VAE dtype: torch.bfloat16
Using xformers cross attention

ETA: I've gone ahead and uninstalled roop. Installed Reactor and MeshGraphormer with no issues or errors. Seems clear that roop's dependency on some antiquated google.protobuf was the culprit. I'll leave this up in hope others might find their solution to a problem that has been confounding me for months.

Foligattilj added a commit to Foligattilj/comfyui_controlnet_aux that referenced this issue Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants