djbielejeski / a-person-mask-generator

Extension for Automatic1111 and ComfyUI to automatically create masks for Background/Hair/Body/Face/Clothes in Img2Img
MIT License
247 stars 30 forks source link

Error loading script #6

Closed artkrylov closed 8 months ago

artkrylov commented 8 months ago

Hi! Thank you for the extension, but I was unable to install it.

Mac mini M1 8Gb A1111 version: v1.6.0-2-g4afaaf8a ./webui.sh --opt-split-attention-v1

*** Error loading script: a_person_mask_generator.py
    Traceback (most recent call last):
      File "/Users/admin/Documents/projects/sd/modules/scripts.py", line 382, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "/Users/admin/Documents/projects/sd/modules/script_loading.py", line 10, in load_module
        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 "/Users/admin/Documents/projects/sd/extensions/a-person-mask-generator/scripts/a_person_mask_generator.py", line 8, in <module>
        import mediapipe as mp
      File "/Users/admin/Documents/projects/sd/venv/lib/python3.10/site-packages/mediapipe/__init__.py", line 16, in <module>
        import mediapipe.python.solutions as solutions
      File "/Users/admin/Documents/projects/sd/venv/lib/python3.10/site-packages/mediapipe/python/solutions/__init__.py", line 17, in <module>
        import mediapipe.python.solutions.drawing_styles
      File "/Users/admin/Documents/projects/sd/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 "/Users/admin/Documents/projects/sd/venv/lib/python3.10/site-packages/mediapipe/python/solutions/drawing_utils.py", line 24, in <module>
        from mediapipe.framework.formats import detection_pb2
      File "/Users/admin/Documents/projects/sd/venv/lib/python3.10/site-packages/mediapipe/framework/formats/detection_pb2.py", line 5, in <module>
        from google.protobuf.internal import builder as _builder
    ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/Users/admin/Documents/projects/sd/venv/lib/python3.10/site-packages/google/protobuf/internal/__init__.py)
djbielejeski commented 8 months ago

Sorry I do not have a M1 or M2 mac to test and fix this issue. PR's welcome though!

Osato28 commented 8 months ago

I have an M1 with Sonoma 14.1.1, and I couldn't replicate this.

Looks like an issue with your installation of protobuf. Judging by what people have to say in a relevant StackOverflow thread, having TensorFlow install protobuf as its dependency might be the cause.

You could try the following solution from that thread:

1) Check if the file builder.py exists at /Users/admin/Documents/projects/sd/venv/lib/python3.10/site-packages/google/protobuf/internal/.

2) If it's missing, upgrade protobuf via pip (pip install --upgrade protobuf), then download latest builder.py from GitHub into that folder.

UPD: Added a link to relevant StackOverflow thread, cleaned up the formatting.

djbielejeski commented 8 months ago

Thanks @Osato28, closing this issue.

artkrylov commented 8 months ago

@Osato28 Thank you! It works!