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

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

Open
dhanushnayak opened this issue Feb 16, 2022 · 17 comments

Comments

@dhanushnayak
Copy link

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

import mediapipe

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

@NowLoadY
Copy link

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
Copy link

Same

@NowLoadY
Copy link

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

@ryanlin0904
Copy link

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

@NowLoadY
Copy link

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
Copy link

se1exin commented May 13, 2022

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
Copy link

ricso commented Nov 12, 2022

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!

@rouderaa
Copy link

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
Copy link

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
Copy link

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
Copy link

bme323 commented Mar 25, 2023

worked for me, thanks!

@ccarmatic
Copy link

ccarmatic commented Apr 28, 2023

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
Copy link

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

@Amrutha0401
Copy link

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
Copy link

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
Copy link

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
Copy link

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.

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