BakingBrains / Real-Time_Background_remover

Using OpenCV and CVzone
40 stars 12 forks source link

TypeError: Descriptors cannot not be created directly. #1

Closed a-ajay closed 2 years ago

a-ajay commented 2 years ago

https://github.com/BakingBrains/Real-Time_Background_remover/blob/2d80f43151a79905cdf98de0c772c7bbeaaaa715/BackgroundRemover.py#L3

Below are the logs

Traceback (most recent call last):
  File "D:\HumanDet\capt.py", line 4, in <module>
    from cvzone.SelfiSegmentationModule import SelfiSegmentation
  File "C:\ProgramData\Anaconda3\envs\HumanD\lib\site-packages\cvzone\SelfiSegmentationModule.py", line 2, in <module>
    import mediapipe as mp
  File "C:\ProgramData\Anaconda3\envs\HumanD\lib\site-packages\mediapipe\__init__.py", line 17, in <module>
    import mediapipe.python.solutions as solutions
  File "C:\ProgramData\Anaconda3\envs\HumanD\lib\site-packages\mediapipe\python\solutions\__init__.py", line 17, in <module>
    import mediapipe.python.solutions.drawing_styles
  File "C:\ProgramData\Anaconda3\envs\HumanD\lib\site-packages\mediapipe\python\solutions\drawing_styles.py", line 20, in <module>
    from mediapipe.python.solutions.drawing_utils import DrawingSpec
  File "C:\ProgramData\Anaconda3\envs\HumanD\lib\site-packages\mediapipe\python\solutions\drawing_utils.py", line 25, in <module>
    from mediapipe.framework.formats import detection_pb2
  File "C:\ProgramData\Anaconda3\envs\HumanD\lib\site-packages\mediapipe\framework\formats\detection_pb2.py", line 16, in <module>
    from mediapipe.framework.formats import location_data_pb2 as mediapipe_dot_framework_dot_formats_dot_location__data__pb2
  File "C:\ProgramData\Anaconda3\envs\HumanD\lib\site-packages\mediapipe\framework\formats\location_data_pb2.py", line 16, in <module>
    from mediapipe.framework.formats.annotation import rasterization_pb2 as mediapipe_dot_framework_dot_formats_dot_annotation_dot_rasterization__pb2
  File "C:\ProgramData\Anaconda3\envs\HumanD\lib\site-packages\mediapipe\framework\formats\annotation\rasterization_pb2.py", line 36, in <module>
    _descriptor.FieldDescriptor(
  File "C:\ProgramData\Anaconda3\envs\HumanD\lib\site-packages\google\protobuf\descriptor.py", line 560, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
a-ajay commented 2 years ago

Solution to this is

pip install protobuf~=3.19.0
BakingBrains commented 2 years ago

@a-ajay did you solve the issue?

BakingBrains commented 2 years ago

I think cvzone==1.3.4 would solve the issue as well.