1

I have installed OpenCv on my Raspberry pi Model 3B. It is working for python 2.7 but not for python 3
The error im getting is:

pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import cv2
Traceback (most recent call last):
File "", line 1, in
File "/home/pi/.local/lib/python3.7/site-packages/cv2/init.py", line 3, in < module>
from .cv2 import *
ImportError: /home/pi/.local/lib/python3.7/site-packages/cv2/cv2.cpython-37m-arm-l inux-gnueabihf.so: undefined symbol: __atomic_fetch_add_8

EDIT :
I tried using cmake: according to https://answers.opencv.org/question/215735/make-error-__atomic_fetch_add_8-on-raspberrypi4/

I am getting the followin error:
pi@raspberrypi:~ $ cmake -DCMAKE_BUILD_TYPE=Release \

-DCMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=${HOME}/opencv_contrib-${OPENCV_VERSION}/m odules \
-D ENABLE_VFPV3=ON \
-D ENABLE_NEON=ON \
-D BUILD_TESTS=OFF \
-D WITH_TBB=OFF
CMake Warning:
No source or binary directory provided. Both will be assumed to be the same as the current working directory, but note that this warning will become a fatal error in future CMake releases.

CMake Error: The source directory "/home/pi" does not appear to contain C MakeLists.txt.

EDIT :

installed opencv-python=4.1.0.25 and it worked using pip install opencv-python=4.1.0.25

asked Feb 28, 2020 at 11:49

1 Answer 1

3

(Updated 12 Oct 2020)

There's a known issue with some old opencv wheels on piwheels. You need to preload python3 with:

LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1 python3

But newer versions are now available: https://www.piwheels.org/project/opencv-python/

answered Feb 28, 2020 at 12:13
1
  • tried it i am getting bash command not found error Commented Feb 28, 2020 at 12:27

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.