superuser789 / MediaPipe-on-RaspberryPi

MediaPipe on Raspberry Pi
41 stars 3 forks source link

Modulenotfounderror: no module named 'mediapipe.python._framework_bindings' #10

Open dhanushnayak opened 2 years ago

dhanushnayak commented 2 years ago

modulenotfounderror: no module named 'mediapipe.python._framework_bindings'

import mediapipe

raising as error of framework_binding in raspberry pi 3 b+.

NowLoadY commented 2 years ago

The same error happened in raspi 4b

" from mediapipe.python._framework_bindings import resource_util ModuleNotFoundError: No module named 'mediapipe.python._framework_bindings'"

What can I do? Thanks!

InkDoMink commented 2 years ago

Same

NowLoadY commented 2 years ago

Finally, today in the afternoon, I tried "pip install mediapipe" on raspi4B 64bit python3.9
It works! maybe you can have a try.

ryanlin0904 commented 2 years ago

May I know do you just type pip install mediapipe in command line? Mine doesnt seem to work on raspi 4B

NowLoadY commented 2 years ago

May I know do you just type pip install mediapipe in command line? Mine doesnt seem to work on raspi 4B

---The Way I Install Mediapipe---

Firstly,get a new system:Raspberry Pi OS (64bit) (2022.1.28) $python -V Python 3.9.2 $sudo apt update $sudo apt upgrade $pip install opencv-python $pip install opencv-contrib-python $pip install mediapipe (mediapipe-0.8.9.1-cp39-cp39-manylinux2014_aarch64.whl)

[automatically installed: matplotlib==3.5.1 attrs>=19.1.0 absl-py==1.0.0 protobuf>=3.11.4 packaging>=20.0 cycler>=0.10 kiwisolver>=1.0.1 python-dateutil==2.8.2 fonttools>=4.22.0]

se1exin commented 2 years ago

I can confirm @NowLoadY 's instructions work - using Raspberry Pi OS (64-bit) lite 2022-04-04

I had to install python3-opencv from apt as well to get all the required dependencies (likely because it's the lite raspberry pi image)

ricso commented 1 year ago

I followed @NowLoadY 's instructions and, even though Mediapipe appeared to install correctly, when I tried to "import" it i received a few errors, per below:

import mediapipe Traceback (most recent call last): File "", line 1, in File "/home/pi/.local/lib/python3.9/site-packages/mediapipe/init.py", line 17, in import mediapipe.python.solutions as solutions File "/home/pi/.local/lib/python3.9/site-packages/mediapipe/python/solutions/init.py", line 17, in import mediapipe.python.solutions.drawing_styles File "/home/pi/.local/lib/python3.9/site-packages/mediapipe/python/solutions/drawing_styles.py", line 20, in from mediapipe.python.solutions.drawing_utils import DrawingSpec File "/home/pi/.local/lib/python3.9/site-packages/mediapipe/python/solutions/drawing_utils.py", line 25, in from mediapipe.framework.formats import detection_pb2 File "/home/pi/.local/lib/python3.9/site-packages/mediapipe/framework/formats/detection_pb2.py", line 16, in from mediapipe.framework.formats import location_data_pb2 as mediapipe_dot_framework_dot_formats_dot_locationdatapb2 File "/home/pi/.local/lib/python3.9/site-packages/mediapipe/framework/formats/location_data_pb2.py", line 16, in from mediapipe.framework.formats.annotation import rasterization_pb2 as mediapipe_dot_framework_dot_formats_dot_annotation_dot_rasterizationpb2 File "/home/pi/.local/lib/python3.9/site-packages/mediapipe/framework/formats/annotation/rasterization_pb2.py", line 36, in _descriptor.FieldDescriptor( File "/home/pi/.local/lib/python3.9/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

I'm no expert but did a few searches and, after downgrading PROTOBUF to 3.20.0 (pip install protobuf==3.20.0), it all worked!

hope this helps!

rouderaa commented 1 year ago

I can confirm that the NowLoadY instructions work on a raspberry pi 4 with a small addition. Here is the script:

NOTE: use 64 bit OS (64bit) (2022.1.28) on raspberry pi 4

sudo apt update sudo apt upgrade pip install opencv-python pip install opencv-contrib-python pip install mediapipe==0.8.9.1 pip uninstall protobuf pip install protobuf==3.20.0

Kind regards, Rob

chinmayabhatb commented 1 year ago

May I know do you just type pip install mediapipe in command line? Mine doesnt seem to work on raspi 4B

---The Way I Install Mediapipe---

Firstly,get a new system:Raspberry Pi OS (64bit) (2022.1.28) $python -V Python 3.9.2 $sudo apt update $sudo apt upgrade $pip install opencv-python $pip install opencv-contrib-python $pip install mediapipe (mediapipe-0.8.9.1-cp39-cp39-manylinux2014_aarch64.whl)

[automatically installed: matplotlib==3.5.1 attrs>=19.1.0 absl-py==1.0.0 protobuf>=3.11.4 packaging>=20.0 cycler>=0.10 kiwisolver>=1.0.1 python-dateutil==2.8.2 fonttools>=4.22.0]

@NowLoadY , thank you very much, it worked for me

NowLoadY commented 1 year ago

May I know do you just type pip install mediapipe in command line? Mine doesnt seem to work on raspi 4B

---The Way I Install Mediapipe--- Firstly,get a new system:Raspberry Pi OS (64bit) (2022.1.28) $python -V Python 3.9.2 $sudo apt update $sudo apt upgrade $pip install opencv-python $pip install opencv-contrib-python $pip install mediapipe (mediapipe-0.8.9.1-cp39-cp39-manylinux2014_aarch64.whl) [automatically installed: matplotlib==3.5.1 attrs>=19.1.0 absl-py==1.0.0 protobuf>=3.11.4 packaging>=20.0 cycler>=0.10 kiwisolver>=1.0.1 python-dateutil==2.8.2 fonttools>=4.22.0]

@NowLoadY , thank you very much, it worked for me

You're welcome, it's not my credit, I simply gave the command line instructions, and I'm more grateful for later additions.❤️

bme323 commented 1 year ago

worked for me, thanks!

ccarmatic commented 1 year ago

Hello, I am using a Raspberry Pi 3B+ and my frame rate is around 1 frame per second, I was wondering what kind of performance are you getting out of Mediapipe by installing it via 'pip install mediapipe' ? Does it include optimizations e.g. Neon ?

Akash3020 commented 1 year ago

@ccarmatic did u find a solution to increase frame rate?? Coz I am stuck with same problem

Amrutha0401 commented 10 months ago

It toatlly worked for me. I tried installing it using various methods didnt work. I changed from 32 bit to64 bit debian os and did it finally for my raspberry pi 3 b model.

rizkyarlin commented 10 months ago

pip install opencv-contrib-python

@Amrutha0401 can you point me to the OS you use? I didn't find specific 64-bit debian for Raspi

rouderaa commented 10 months ago

Hi rizkyarlin, You can use the raspbian 64 bit version 2022.1.28 in the rapberry pi imager tool (https://www.raspberrypi.com/software/) which is debian 11 (If I remember correctly). Regards, Rob

rizkyarlin commented 10 months ago

Hi rizkyarlin,

You can use the raspbian 64 bit version 2022.1.28 in the rapberry pi imager tool (https://www.raspberrypi.com/software/)

which is debian 11 (If I remember correctly).

Regards,

Rob

Thank you, rob. Unfortunately I'm using RPi 3, that OS is not available for RPi 3 in the imager.