I got an error when I put opencv in python3 with Raspberry Pi [Remedy]

I was in trouble because I couldn't install or uninstall opencv well, but I managed to install it, so I will write the details.

Error status

pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/cv2/__init__.py", line 3, in <module>
    from .cv2 import *
ImportError: /home/pi/cv2/cv2.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_fetch_add_8

How to insert opencv

First, based on Installing OpenCV 3 on Raspberry Pi + Python 3 as easily as possible

$ sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-103
$ sudo apt-get install libqtgui4 libqtwebkit4 libqt4-test python3-pyqt5
$ sudo apt-get install libatlas-base-dev
$ sudo apt-get install libjasper-dev

Install the library used by opencv. Here sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-103 seems to change depending on the version If you get an error, you may be able to break through by changing the *** of sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-***.

next

sudo pip3 --default-timeout=1000 install opencv-python

Put opencv by.

When I run it in this state, I get the above error

How to break through the error

Here because I got the same error I ran the destination of the link that was posted. First run this in the terminal

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

Then edit with vim

vim.tiny .bashrc
export LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1 #Add this sentence

vim saves with : wq from edit mode ʻESC in ʻa and exits. If you make a mistake, exit without saving with : q! From ʻESC`.

Finally

source .bashrc

Apply with

I will check it

$ python3
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.1'

It is certainly installed.

Recommended Posts

I got an error when I put opencv in python3 with Raspberry Pi [Remedy]
I get an error when I put opencv in pyautoGUI
Resolved an error when putting pygame in python3 on raspberry pi
I got an error when using Tensorboard with Pytorch
I got an error in vim and zsh in Python 3.7 series
I got an AttributeError when mocking the open method in python
When I get an error with Pylint in Atom on Windows
When I get an error with PyInstaller
When I installed python on macOS and used it, I got an error when I put an https connection
I tried L-Chika with Raspberry Pi 4 (Python edition)
How to put OpenCV in Raspberry Pi and easily collect images of face detection results with Python
I get an error when I put a Python plugin in Visual Studio Code under the pyenv environment
[Python] I want to know the variables in the function when an error occurs!
I got an error when trying to run Hello World in Go language
What I did when I got stuck in the time limit with lambda python
I got an error that Python couldn't read settings.ini
I get an Import Error in Python Beautiful Soup
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
When you get an error in python scraping (requests)
Display USB camera video with Python OpenCV with Raspberry Pi
I got stuck when trying to specify a relative path with relative_to () in python
Error when playing with python
I got an error when pip install pandas on Mac, so I dealt with it
I got a Value Error when using JUMAN ++ with PyKNP
When I made CaboCha usable with python3, I got stuck (Windows 10)
I tried running Movidius NCS with python of Raspberry Pi3
Create an LCD (16x2) game with Raspberry Pi and Python
I got an error when pip install tweepy on macOS Sierra, so I dealt with it
I wrote python3.4 in .envrc with direnv and allowed it, but I got a syntax error
Use vl53l0x with Raspberry Pi (python)
Put python, numpy, opencv3 in ubuntu14
I sent an SMS with Python
Use OpenCV with Python 3 in Window
Draw an illustration with Python + OpenCV
Getting Started with Heroku-Viewing Hello World in Python Django with Raspberry PI 3
I got an error when I ran composer global require laravel / installer
I get an error when trying to install maec 4.0.1.0 with pip
I want to run the Python GUI when starting Raspberry Pi
I got an error when I ran meteor add accounts-password and got hooked
I tried to make an image similarity function with Python + OpenCV
I got an SSL Error when I installed Anaconda in a new environment, so I solved it (Windows10, Anaconda3-2019.10)
I get an OS Error: [Errno 8] Exec format error when running a Flask application with a python command
About the error I encountered when trying to use Adafruit_DHT from Python on a Raspberry Pi
I want to improve efficiency with Python even in an experimental system (4) Use ser.close () when an error is thrown using try syntax
I put Python 2.7 in Sakura VPS 1GB.
I get an error with import pandas.
Put ROS melodic in Raspberry Pi 4 / Buster
Put OpenCV in OS X with Homebrew and input / output video with python
Note when creating an environment with python
I got an error when trying to install Xgboost and its solution
I got an SSL related error with pip install, so I solved it
I tried sending an email with python.
I tried non-photorealistic rendering with Python + opencv
I tried to make a traffic light-like with Raspberry Pi 4 (Python edition)
RabbitMQ message notification app in Python with Growl ~ with Raspberry Pi and Julius ~
I got an unfamiliar error in Django: TypeError: resolve () got an unexpected keyword argument'strict'
A reminder of what I got stuck when starting Atcoder with python
Operate an oscilloscope with a Raspberry Pi
Working with GPS on Raspberry Pi 3 Python
Wall to put OpenCV 3.1.0 in raspberry pi 3 and run sample on python3: ImportError: No module named cv2 solution
In the Chainer tutorial, I get an error when importing a package. (mock)