superuser789 / MediaPipe-on-RaspberryPi

MediaPipe on Raspberry Pi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

dhanushnayak opened this issue · comments

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

import mediapipe

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

commented

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!

Same

commented

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

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

commented

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]

commented

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)

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!

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

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

commented

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