Closed goulaoalex closed 2 years ago
I've also experienced the error "AttributeError: module 'mediapipe' has no attribute 'solutions'" after uninstalling and instaling mediapipe.
Hi @goulaoalex , Thanks for raising issue ,did you get a chance to check this issue https://github.com/google/mediapipe/issues/1346
I checked the issue and followed the steps from "https://github.com/superuser789/MediaPipe-on-RaspberryPi#readme"
But while building mediapipe with "python3 setup.py bdist_wheel" I got the following error message:
/home/pi/.cache/bazel/_bazel_pi/b64ded70520c15cba5314bb754a27c61/external/com_google_absl/absl/base/BUILD.bazel:201:11: Compiling absl/base/internal/cycleclock.cc failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 44 arguments skipped)
Do you know what might be causing this?
Further note: "gcc is already the newest version (4:10.2.1-1)."
I have the same issue too. OS : Raspberry Pi OS 64bit bullseye. Kernel Version : 5.10.92-v8+ GCC version : 10.2.1 20210110(Debian 10.2.1-6)
ENV: virtualenv environment : mediapipe-rpi4 ==0.8.8 opencv-python==4.5.5.62 opencv-contrib-python==4.5.5.62 numpy==1.22.2
and encount the same issue when i try to print multi_hand_landmarks..
Hey yoyojacky I followed the installation method from https://google.github.io/mediapipe/getting_started/install.html and I got it to work!
However I wasn't able to install bazelisk so I followed the following method to install bazel from source:
sudo apt-get install openjdk-11-jdk
sudo nano /etc/dphys-swapfile 2048 sudo /etc/init.d/dphys-swapfile stop sudo /etc/init.d/dphys-swapfile start
wget https://github.com/bazelbuild/bazel/releases/download/5.0.0/bazel-5.0.0-dist.zip unzip -d bazel bazel-5.0.0-dist.zip cd bazel
sudo nano scripts/bootstrap/compile.sh -c Line 144 -J-Xmx1024M
env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh sudo cp output/bazel /usr/local/bin/bazel
I hope this can help you.
Hi goulaoalex, I am going to try it out, thanks for your tips...
Hey yoyojacky I followed the installation method from https://google.github.io/mediapipe/getting_started/install.html and I got it to work!
However I wasn't able to install bazelisk so I followed the following method to install bazel from source:
sudo apt-get install openjdk-11-jdk
sudo nano /etc/dphys-swapfile 2048 sudo /etc/init.d/dphys-swapfile stop sudo /etc/init.d/dphys-swapfile start
wget https://github.com/bazelbuild/bazel/releases/download/5.0.0/bazel-5.0.0-dist.zip unzip -d bazel bazel-5.0.0-dist.zip cd bazel
sudo nano scripts/bootstrap/compile.sh -c Line 144 -J-Xmx1024M
env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh sudo cp output/bazel /usr/local/bin/bazel
I hope this can help you.
hello i followed your method with a bit of researching on some details, i get to install bazel however the error still occured mediapipe.framework binding error, is there any solution u have in mind? thank u
Hey, when you type "import mediapipe" in python does it give out the framework error or does it load instantly? Also, while building mediapipe with bazel did you get any errors?
Hey, when you type "import mediapipe" in python does it give out the framework error or does it load instantly? Also, while building mediapipe with bazel did you get any errors?
i did, as shown on the image that i uploaded mediapipe.python._framework_bindings error
What about the mediapipe bazel build, did you get any errors?
What about the mediapipe bazel build, did you get any errors?
what do you mean? should i suppose to build mediapipe with bazel? because i haven't done that yet
Yep, from my experience installing mediapipe with pip3 doesn't work on raspberry pi 3. Follow the "Installing on Debian and Ubuntu" tutorial from this page https://google.github.io/mediapipe/getting_started/install.html#installing-on-debian-and-ubuntu
If you need help with any steps let me know.
Yep, from my experience installing mediapipe with pip3 doesn't work on raspberry pi 3. Follow the "Installing on Debian and Ubuntu" tutorial from this page https://google.github.io/mediapipe/getting_started/install.html#installing-on-debian-and-ubuntu
If you need help with any steps let me know.
thank u, i actually had problems following some steps from the site that u gave, it would be helpful
In which steps did you have problems?
In which steps did you have problems?
hey i just did the steps from that site, i followed the steps accordingly and even done the config for opencv. That's the option i did too( _Option 2. Run setup_opencv.sh to automatically build OpenCV from source and modify MediaPipe’s OpenCV config. This option will do all steps defined in Option 3 automatically._ ) however, it still gave me the same error
After that follow this steps: https://google.github.io/mediapipe/getting_started/python.html#building-mediapipe-python-package
After that follow this steps: https://google.github.io/mediapipe/getting_started/python.html#building-mediapipe-python-package
thank u, but what does it mean here (4. In the virtual environment, go to the MediaPipe repo directory.)
In the installation, you probably cloned the mediapipe repository with "git clone https://github.com/google/mediapipe.git"
So going to the mediapipe repo directory is just to "cd mediapipe"
In the installation, you probably cloned the mediapipe repository with "git clone https://github.com/google/mediapipe.git"
So going to the mediapipe repo directory is just to "cd mediapipe"
hey, thanks for helping me so far im at step 5 rn (_Install the required Python packages.
(mpenv)mediapipe$ pip3 install -r requirements.txt) my only concern is im at the building wheel process for opencv-contrib-python (PEP517) i heard there's an issue about this being stuck for long (EDIT: It's been running for a bit long now), i experienced that from numpy it took awhile to install so i wonder if you just waited for it to finish?
Yes the building wheel process took a long time for me too, I usually wait for it to build (if it doesn't give out an error). If the build fails trying upgrading the setup tools with this:
pip install --upgrade pip setuptools wheel
So uhm the update is, ive been running my rpi for like 4+ hours installing opencv and i've noticed it still haven't completed installing yet, i tried upgrading using that command line too,
regarding if there's a build error, there hasn't been one it just stuck to this state... Building wheel for opencv-contrib-python (pyproject.toml) ...
If that's the case then it's probably not gonna work. I don't remember having problems with opencv-contrib. Maybe try this with this command:
sudo apt install python3-opencv
It's all I used to install opencv
i tried running that command and this was the out put python3-opencv is already the newest version (4.5.1+dfsg-5). Im installing inside a virtual env btw, as stated in the installation
Given below is the list of outputs while build for opencv-contrib recently (mp_env) pi@raspberrypi:~/mediapipe $ pip3 install -r requirements.txt Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting absl-py Using cached https://www.piwheels.org/simple/absl-py/absl_py-1.0.0-py3-none-any.whl (126 kB) Collecting attrs>=19.1.0 Using cached https://www.piwheels.org/simple/attrs/attrs-21.4.0-py2.py3-none-any.whl (60 kB) Collecting matplotlib Using cached https://www.piwheels.org/simple/matplotlib/matplotlib-3.5.1-cp39-cp39-linux_armv7l.whl (10.7 MB) Collecting numpy Using cached https://www.piwheels.org/simple/numpy/numpy-1.22.3-cp39-cp39-linux_armv7l.whl (12.9 MB) Collecting opencv-contrib-python Using cached opencv-contrib-python-4.5.5.64.tar.gz (150.4 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting protobuf>=3.11.4 Using cached https://www.piwheels.org/simple/protobuf/protobuf-3.19.4-py2.py3-none-any.whl (162 kB) Collecting six Using cached https://www.piwheels.org/simple/six/six-1.16.0-py2.py3-none-any.whl (11 kB) Collecting pillow>=6.2.0 Using cached https://www.piwheels.org/simple/pillow/Pillow-9.0.1-cp39-cp39-linux_armv7l.whl (1.1 MB) Collecting cycler>=0.10 Using cached https://www.piwheels.org/simple/cycler/cycler-0.11.0-py3-none-any.whl (6.4 kB) Collecting python-dateutil>=2.7 Using cached https://www.piwheels.org/simple/python-dateutil/python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB) Collecting fonttools>=4.22.0 Using cached https://www.piwheels.org/simple/fonttools/fonttools-4.30.0-cp39-cp39-linux_armv7l.whl (1.3 MB) Collecting kiwisolver>=1.0.1 Downloading kiwisolver-1.4.0.tar.gz (95 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 95.9/95.9 KB 1.6 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting pyparsing>=2.2.1 Using cached https://www.piwheels.org/simple/pyparsing/pyparsing-3.0.7-py3-none-any.whl (98 kB) Collecting packaging>=20.0 Using cached https://www.piwheels.org/simple/packaging/packaging-21.3-py3-none-any.whl (40 kB) Building wheels for collected packages: opencv-contrib-python, kiwisolver Building wheel for opencv-contrib-python (pyproject.toml) ... -^canceled
I don't know the solution for the building wheel problem, I've also experienced it a couple of times and sometimes it worked and others it didn't. My advice would be to either let the building wheel process run overnight or try building opencv from source since you also download the source code for opencv-contrib.
Here's a tutorial that I know works for the opencv installation from source (it works for raspberry pi 3): https://singleboardbytes.com/647/install-opencv-raspberry-pi-4.htm
This process takes a while (the make command usually took me around 4 hours), but if you don't have any other solution give it a shot.
I don't know the solution for the building wheel problem, I've also experienced it a couple of times and sometimes it worked and others it didn't. My advice would be to either let the building wheel process run overnight or try building opencv from source since you also download the source code for opencv-contrib.
Here's a tutorial that I know works for the opencv installation from source (it works for raspberry pi 3): https://singleboardbytes.com/647/install-opencv-raspberry-pi-4.htm
This process takes a while (the make command usually took me around 4 hours), but if you don't have any other solution give it a shot.
Does it also works with Raspberry pi 3 b+ model?
Yes I have the same model and it worked for me.
Yes I have the same model and it worked for me.
hello thank you, i successfully installed opencv since i thoroughly followed the instructions, however i just noticed that i was using two diff. env the one from mediapipe (mp_env) and opencv (sbb_cv) from the instruction you sent, should i install the mediapipe to the (sb_cvv) environment? or should i redo the installation but this time to the mediapipe environment i was thinking of using thonny python too for coding
Just install mediapipe to the sb_cvv environment so you don't have to redo the opencv installation
Just install mediapipe to the sb_cvv environment so you don't have to redo the opencv installation
im on this step rn _5. Install the required Python packages.
(mpenv)mediapipe$ pip3 install -r requirements.txt
hello, im just installing mediapipe requirements rn however it started building wheels for opencv-contrib-python again, should i skip this since i have opencv installed or should i wait
That shouldn't be the case since you already have opencv-contrib installed. You can try skipping the step (or simply removing it from the text file).
Im doing step 6 (last step) I encountered this error
Right now im retrying it again with the use of the second option
I've also experienced that error, the solution I found was to use an older version of gcc and gcc++ I used gcc 9.
Here's the tutorial I used to switch versions: https://linuxconfig.org/how-to-switch-between-multiple-gcc-and-g-compiler-versions-on-ubuntu-20-04-lts-focal-fossa
I can't say 100% for sure that it will work, I was also stuck on that error for a while but I got to it work somehow with this.
I've also experienced that error, the solution I found was to use an older version of gcc and gcc++ I used gcc 9.
Here's the tutorial I used to switch versions: https://linuxconfig.org/how-to-switch-between-multiple-gcc-and-g-compiler-versions-on-ubuntu-20-04-lts-focal-fossa
I can't say 100% for sure that it will work, I was also stuck on that error for a while but I got to it work somehow with this.
Sadly, it didn't work for me i tried using auto and manual mode
(sbb_cv) pi@raspberrypi:~/mediapipe $ python3 setup.py install --link-opencv
/home/pi/.virtualenvs/sbb_cv/lib/python3.9/site-packages/setuptools/dist.py:519: UserWarning: The version specified ('dev') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
warnings.warn(
running install
/home/pi/.virtualenvs/sbb_cv/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build_binary_graphs
generating binarypb: mediapipe/modules/face_detection/face_detection_short_range_cpu
DEBUG: Rule 'rules_foreign_cc' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "c2cdcf55ffaf49366725639e45dedd449b8c3fe22b54e31625eb80ce3a240f1e"
DEBUG: Repository rules_foreign_cc instantiated at:
/home/pi/mediapipe/WORKSPACE:42:13: in
Sadly I don't know the solution for that error and I don't know how to help you there, for me after that somehow it worked.
I was sent this video today on a post I made a few weeks ago on stackoverflow if you wanna check it out. I don't know if this method works or not but at least it's recent.
https://www.youtube.com/watch?v=vF6fwKN06lM
They are saying to use raspbian buster
Sadly I don't know the solution for that error and I don't know how to help you there, for me after that somehow it worked.
I was sent this video today on a post I made a few weeks ago on stackoverflow if you wanna check it out. I don't know if this method works or not but at least it's recent.
https://www.youtube.com/watch?v=vF6fwKN06lM
They are saying to use raspbian buster
Hello may i ask what python version were you using?, because i was using 3.9 while building mediapipe, i think that might've caused it because i think mediapipe does not support 3.9 or it doesn't matter
Referenced issue: "pip install mediapipe" does not work #1466
I was using version 3.9.2. Mediapipe does support newer versions than 3.6 and 3.8, I think that issue is outdated.
pip install mediapipe, however, doesn't work for raspberry for some reason, that's why someone created the "pip install mediapipe-rpi3" package. But I also think that said package doesn't work anymore for the newer versions of raspbian.
I spent a lot of time switching between python version, I can assure it always gave me the same framework error.
I spent a lot of time switching between python version, I can assure it always gave me the same framework error.
(sbb_cv) pi@raspberrypi:~/mediapipe $ python3 setup.py install --link-opencv /home/pi/.virtualenvs/sbb_cv/lib/python3.9/site-packages/setuptools/dist.py:519: UserWarning: The version specified ('dev') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details. warnings.warn( running install /home/pi/.virtualenvs/sbb_cv/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build_binary_graphs generating binarypb: mediapipe/modules/face_detection/face_detection_short_range_cpu DEBUG: /home/pi/.cache/bazel/_bazel_pi/b64ded70520c15cba5314bb754a27c61/external/org_tensorflow/third_party/repo.bzl:122:14: Warning: skipping import of repository 'com_google_absl' because it already exists. DEBUG: /home/pi/.cache/bazel/_bazel_pi/b64ded70520c15cba5314bb754a27c61/external/org_tensorflow/third_party/repo.bzl:122:14: Warning: skipping import of repository 'com_google_benchmark' because it already exists. DEBUG: /home/pi/.cache/bazel/_bazel_pi/b64ded70520c15cba5314bb754a27c61/external/org_tensorflow/third_party/repo.bzl:122:14: Warning: skipping import of repository 'pybind11_bazel' because it already exists. DEBUG: /home/pi/.cache/bazel/_bazel_pi/b64ded70520c15cba5314bb754a27c61/external/org_tensorflow/third_party/repo.bzl:122:14: Warning: skipping import of repository 'com_google_protobuf' because it already exists. DEBUG: /home/pi/.cache/bazel/_bazel_pi/b64ded70520c15cba5314bb754a27c61/external/org_tensorflow/third_party/repo.bzl:122:14: Warning: skipping import of repository 'com_google_googletest' because it already exists. DEBUG: /home/pi/.cache/bazel/_bazel_pi/b64ded70520c15cba5314bb754a27c61/external/org_tensorflow/third_party/repo.bzl:122:14: Warning: skipping import of repository 'com_github_gflags_gflags' because it already exists. DEBUG: /home/pi/.cache/bazel/_bazel_pi/b64ded70520c15cba5314bb754a27c61/external/org_tensorflow/third_party/repo.bzl:122:14: Warning: skipping import of repository 'build_bazel_rules_apple' because it already exists. DEBUG: /home/pi/.cache/bazel/_bazel_pi/b64ded70520c15cba5314bb754a27c61/external/org_tensorflow/third_party/repo.bzl:122:14: Warning: skipping import of repository 'build_bazel_rules_swift' because it already exists. DEBUG: /home/pi/.cache/bazel/_bazel_pi/b64ded70520c15cba5314bb754a27c61/external/org_tensorflow/third_party/repo.bzl:122:14: Warning: skipping import of repository 'build_bazel_apple_support' because it already exists. DEBUG: /home/pi/.cache/bazel/_bazel_pi/b64ded70520c15cba5314bb754a27c61/external/org_tensorflow/third_party/repo.bzl:122:14: Warning: skipping import of repository 'xctestrunner' because it already exists. DEBUG: /home/pi/.cache/bazel/_bazel_pi/b64ded70520c15cba5314bb754a27c61/external/org_tensorflow/third_party/repo.bzl:122:14: Warning: skipping import of repository 'pybind11' because it already exists. WARNING: /home/pi/mediapipe/mediapipe/framework/BUILD:54:24: in cc_library rule //mediapipe/framework:calculator_cc_proto: target '//mediapipe/framework:calculator_cc_proto' depends on deprecated target '@com_google_protobuf//:cc_wkt_protos': Only for backward compatibility. Do not use. WARNING: /home/pi/mediapipe/mediapipe/framework/tool/BUILD:182:24: in cc_library rule //mediapipe/framework/tool:field_data_cc_proto: target '//mediapipe/framework/tool:field_data_cc_proto' depends on deprecated target '@com_google_protobuf//:cc_wkt_protos': Only for backward compatibility. Do not use. INFO: Analyzed target //mediapipe/modules/face_detection:face_detection_short_range_cpu (0 packages loaded, 0 targets configured). INFO: Found 1 target... ERROR: /home/pi/mediapipe/mediapipe/calculators/util/BUILD:797:11: Compiling mediapipe/calculators/util/detection_projection_calculator.cc failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 63 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
In file included from ./mediapipe/framework/packet.h:31,
from ./mediapipe/framework/graph_service_manager.h:8,
from ./mediapipe/framework/calculator_state.h:30,
from ./mediapipe/framework/calculator_context.h:23,
from ./mediapipe/framework/calculator_base.h:23,
from ./mediapipe/framework/calculator_framework.h:54,
from mediapipe/calculators/util/detection_projection_calculator.cc:21:
mediapipe/calculators/util/detection_projection_calculator.cc: In substitution of 'template<class _Functor, class, class> std::function<std::unique_ptrmediapipe::internal::CalculatorBaseFactory()>::function(_Functor) [with _Functor = ; = ; = ]':
mediapipe/calculators/util/detection_projection_calculator.cc:58:1: required from here
./mediapipe/framework/deps/registration.h:387:52: internal compiler error: Segmentation fault
387 | RegistryType::Register(#name, VA_ARGS))
| ^
./mediapipe/framework/calculator_registry.h:24:3: note: in expansion of macro 'REGISTER_FACTORY_FUNCTION_QUALIFIED'
24 | REGISTER_FACTORY_FUNCTION_QUALIFIED(
| ^~~~~~~~~~~
mediapipe/calculators/util/detection_projection_calculator.cc:58:1: note: in expansion of macro 'REGISTER_CALCULATOR'
58 | REGISTER_CALCULATOR(DetectionProjectionCalculator);
| ^~~~~~~
0x76a57d9f ???
../sysdeps/unix/sysv/linux/arm/sigrestorer.S:64
0x76a3fbdf __libc_start_main
./csu/libc-start.c:308
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See file:///usr/share/doc/gcc-10/README.Bugs for instructions.
Target //mediapipe/modules/face_detection:face_detection_short_range_cpu failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 101.143s, Critical Path: 97.73s
INFO: 135 processes: 129 internal, 6 linux-sandbox.
FAILED: Build did NOT complete successfully
i tried changing gcc into latest and build again and the next thing happened is that it still failed but it says to submit a full bug report
/sysdeps/unix/sysv/linux/arm/sigrestorer.S:64
idk if it's like the required processor but i think that might be the cause
(sbb_cv) pi@raspberrypi:~/mediapipe $ uname -m armv7l
i guess im using a 32 bit processor
Honestly I don't know for sure, but armv7l is a 32bit processor. You are using the 64-bit debian version right?
Honestly I don't know for sure, but armv7l is a 32bit processor. You are using the 64-bit debian version right?
Im using 32 bit
I installed mine with the 64-bit version, I don't know if that's the cause of the problem or not but either way I got the same error as you in my version.
64bit OS may not working properly, i am using raspberry pi OS 64bit (codename: bullseye) and it can not work properly. I have installed via:
pip install mediapipe-rpi4
but when i write demo code to test it. .... program crashed ....
I had the same problem using Python 3.8.0 on Rpi4 (bullseye)
$ python
Python 3.8.0 (default, Mar 22 2022, 08:04:42)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mediapipe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/stefan/hand_tracking/venv/lib/python3.8/site-packages/mediapipe/__init__.py", line 16, in <module>
from mediapipe.python import *
File "/home/stefan/hand_tracking/venv/lib/python3.8/site-packages/mediapipe/python/__init__.py", line 17, in <module>
from mediapipe.python._framework_bindings import resource_util
ModuleNotFoundError: No module named 'mediapipe.python._framework_bindings'
I had installed mediapipe using pip install mediapipe-rpi4
I solved it with pip install mediapipe
Now:
$ python
Python 3.8.0 (default, Mar 22 2022, 08:04:42)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mediapipe
>>>
when I use
pip install mediapipe
in raspi4, get errorERROR: Could not find a version that satisfies the requirement mediapipe ERROR: No matching distribution found for mediapipe
@[stefan-sherwood](https://github.com/stefan-sherwood)
@hutaohutc What version of Python are you using?
Edit: also, what version of pip?
@hutaohutc What version of Python are you using?
python 3.9 @stefan-sherwood
stefan-sherwood thanks!
Hello, I'm having problems using mediapipe on my raspberry pi 3. Using "import mediapipe" gives no error, however using "mp_drawing = mp.solutions.drawing_utils" (for example) gives out the following error message: ModuleNotFoundError: No module named 'mediapipe.python._framework_bindings'
My installation method was:
I'm using a raspberry pi 3b with debian bullseye (32 bit), my python version is 3.9.2 and the opencv version is 4.2.1. P.S. the file name is "maos.py".
Does anyone know what might be causing this error? (I annexed an image of the error aswell for clarity )