MediaPipe-on-RaspberryPi icon indicating copy to clipboard operation
MediaPipe-on-RaspberryPi copied to clipboard

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

Open dhanushnayak opened this issue 4 years ago • 17 comments

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

import mediapipe

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

dhanushnayak avatar Feb 16 '22 01:02 dhanushnayak

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!

NowLoadY avatar Feb 22 '22 08:02 NowLoadY

Same

InkDoMink avatar Feb 23 '22 15:02 InkDoMink

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

NowLoadY avatar Mar 22 '22 16:03 NowLoadY

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

ryanlin0904 avatar Mar 24 '22 23:03 ryanlin0904

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 avatar Mar 26 '22 14:03 NowLoadY

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)

se1exin avatar May 13 '22 09:05 se1exin

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_location__data__pb2 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_rasterization__pb2 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!

ricso avatar Nov 12 '22 17:11 ricso

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

rouderaa avatar Jan 14 '23 12:01 rouderaa

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

chinmayabhatb avatar Jan 20 '23 13:01 chinmayabhatb

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.❤️

NowLoadY avatar Jan 20 '23 16:01 NowLoadY

worked for me, thanks!

bme323 avatar Mar 25 '23 02:03 bme323

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 ?

ccarmatic avatar Apr 28 '23 21:04 ccarmatic

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

Akash3020 avatar Jul 15 '23 05:07 Akash3020

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.

Amrutha0401 avatar Nov 14 '23 16:11 Amrutha0401

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

rizkyarlin avatar Nov 20 '23 11:11 rizkyarlin

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

rouderaa avatar Nov 20 '23 13:11 rouderaa

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.

rizkyarlin avatar Nov 20 '23 21:11 rizkyarlin