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

ImportError: /usr/local/lib/python3.7/dist-packages/cv2/cv2.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_fetch_add_8 #67

Open
happy-little-zhang opened this issue Nov 20, 2019 · 41 comments

Comments

@happy-little-zhang
Copy link

Raspberry 4
python 3.7
tensorflow 2.0
i follow your guidence , and this issues happended at last ,
图片
how should i do ?

@mentianyi
Copy link

rp3b+,same error.

@saifsmailbox98
Copy link

Same error using Raspbian Buster

@saifsmailbox98
Copy link

saifsmailbox98 commented Nov 21, 2019

Tried this workaround:

$ LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0 python3 Object_detection_picamera.py  --usbcam

Getting a new error now:

Traceback (most recent call last):
  File "Object_detection_picamera.py", line 27, in <module>
    import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'

Not sure if they are relevant.

Edit: Not relevant. The workaround should work.

@mentianyi
Copy link

Tried this workaround:

$ LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0 python3 Object_detection_picamera.py  --usbcam

Getting a new error now:

Traceback (most recent call last):
  File "Object_detection_picamera.py", line 27, in <module>
    import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'

Not sure if they are relevant.

Edit: Not relevant. The workaround should work.

No help..

@saifsmailbox98
Copy link

Tried this workaround:

$ LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0 python3 Object_detection_picamera.py  --usbcam

Getting a new error now:

Traceback (most recent call last):
  File "Object_detection_picamera.py", line 27, in <module>
    import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'

Not sure if they are relevant.
Edit: Not relevant. The workaround should work.

No help..

Getting the same error?

@Zach-OP
Copy link

Zach-OP commented Nov 22, 2019

I'm seeing this as well.

@Zach-OP
Copy link

Zach-OP commented Nov 22, 2019

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

@happy-little-zhang
Copy link
Author

i used another way to solve this issue yesterday, but it's not convenient
i first install opencv follow other guidence
https://www.pyimagesearch.com/2019/09/16/install-opencv-4-on-raspberry-pi-4-and-raspbian buster/ ,
then i skep the step of installing opencv in this guidence .
the result is i need to execute some extra code everytime i run the "Object_detection_picamera.py", they are :

  1. sudo find / -type f -name ‘atom.so*’
  2. LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0 python3 Object_detection_picamera.py

@happy-little-zhang
Copy link
Author

i tried your way today , and it did works .
thank you for taking the time to solve this issue @Zach-OP

@jlbs86
Copy link

jlbs86 commented Dec 2, 2019

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

thank you so much Zach-Op

@ueray
Copy link

ueray commented Dec 18, 2019

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

When i try this, i get the error ''Could not install packages due to an EnvironmentError: 404 Client Error: Not found for url: https://pypi.org/simple/opencv-pyhton/''

Do you have any idea to achieve this problem?

@Pupan-cpe
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

NICE !!!

@insung3511
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

i have same error.. but is not helped. i try this solution and this. but also it doesnt work.. anybody plz help me 😭

@deysarkarswarup
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

it did work with previous versions of opencv.. thanks

@andromeda1998
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

Thank you so much! Worked like charm!

@vietanha74
Copy link

Thanks you so much @Zach-OP It really useful !!!

@Riverlox12
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python
It gives me this when i install the older version

2020-02-09 05:51:42.552137: E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0x2948490 (ENOSPC)
mmal: mmal_connection_enable: output port couldn't be enabled
Traceback (most recent call last):
File "Object_detection_picamera.py", line 124, in
camera = PiCamera()
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 433, in init
self._init_preview()
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 513, in _init_preview
self, self._camera.outputs[self.CAMERA_PREVIEW_PORT])
File "/usr/lib/python3/dist-packages/picamera/renderers.py", line 558, in init
self.renderer.inputs[0].connect(source).enable()
File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2212, in enable
prefix="Failed to enable connection")
File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources

@modarm-e
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

Thank you sooooooo much

@gdoise
Copy link

gdoise commented Feb 20, 2020

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

It worked for me on RPI 3 B. It uninstalled my opencv_python-4.1.1.26 now it's ok with opencv-python==3.4.6.27.
Thanks a lot !

@svsadafule
Copy link

rp3b+,same error.

Use OpenCV contrib with the right version.

pip install opencv-contrib-python==4.1.0.25

@bharath-velisala
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

i excecuted the same python 3.4.6.27 was installed but againg showing the same error

@Riverlox12
Copy link

Riverlox12 commented Feb 28, 2020 via email

@Edwiinrtz
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

it works well for me thanks

@harshbhatt99
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python
It gives me this when i install the older version

2020-02-09 05:51:42.552137: E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0x2948490 (ENOSPC)
mmal: mmal_connection_enable: output port couldn't be enabled
Traceback (most recent call last):
File "Object_detection_picamera.py", line 124, in
camera = PiCamera()
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 433, in init
self._init_preview()
File "/usr/lib/python3/dist-packages/picamera/camera.py", line 513, in _init_preview
self, self._camera.outputs[self.CAMERA_PREVIEW_PORT])
File "/usr/lib/python3/dist-packages/picamera/renderers.py", line 558, in init
self.renderer.inputs[0].connect(source).enable()
File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 2212, in enable
prefix="Failed to enable connection")
File "/usr/lib/python3/dist-packages/picamera/exc.py", line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources

Did you solve this? I have same issue

@Martink-NZ
Copy link

I tried Zac's approach to uninstall and then install OpenCV. I tried using LD_PRELOAD. I tried using VIRTUALWRAPPER_PYTHON. I tried mkvirtualenv cv2. None of them worked.
I use Pi 4, 4GB and Intel Movidius NCS2, Python 3.7. Any other suggestions are much appreciated. This has taken much too much time to get resolved. Hopefully there is an easy solution.
Many thanks, Martin from NZ

@Pupan-cpe
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

thanks

@shubhamkhandhar
Copy link

I tried Zac's approach to uninstall and then install OpenCV. I tried using LD_PRELOAD. I tried using VIRTUALWRAPPER_PYTHON. I tried mkvirtualenv cv2. None of them worked.
I use Pi 4, 4GB and Intel Movidius NCS2, Python 3.7. Any other suggestions are much appreciated. This has taken much too much time to get resolved. Hopefully there is an easy solution.
Many thanks, Martin from NZ

I am also getting the same issue on rpi 4 . Someone plz help

@shubhamkhandhar
Copy link

I tried Zac's approach to uninstall and then install OpenCV. I tried using LD_PRELOAD. I tried using VIRTUALWRAPPER_PYTHON. I tried mkvirtualenv cv2. None of them worked.
I use Pi 4, 4GB and Intel Movidius NCS2, Python 3.7. Any other suggestions are much appreciated. This has taken much too much time to get resolved. Hopefully there is an easy solution.
Many thanks, Martin from NZ

Did you found any solution please post it

@60999
Copy link

60999 commented May 6, 2020

$ vi .bashrc (or nano .bashrc under root)
add:export LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1
exit with save file.
$ source .bashrc
$ 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

It will work.

@yoher
Copy link

yoher commented May 14, 2020

Update following @Zach-OP advice to stay away from the latest version:
On a Pi4 today :

  • OpenCV 4.1.1.26 KO
  • OpenCV 4.1.0.25 imports properly and seems to run fine so far
    => Install with pip3 install opencv-python==4.1.0.25

@shubhamkhandhar
Copy link

shubhamkhandhar commented May 15, 2020 via email

@lukedavoli
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

god bless you

@preyash2047
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

thank you bro, it worked for me

@Keylem
Copy link

Keylem commented Jun 8, 2020

$ vi .bashrc (or nano .bashrc under root)
add:export LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1
exit with save file.
$ source .bashrc
$ 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

It will work.

Thanks worked like charm with 4.1.1 😍

@xlla
Copy link

xlla commented Jun 22, 2020

how to export LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1
for sudo command ?
I want to use framebuffer over ssh, if invoke without sudo , it complain
pygame.error: Unable to open a console terminal

@mdjunaidahmed0123
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python

i excecuted the same python 3.4.6.27 was installed but againg showing the same error

hi bharath4284
i too tried the same and same error i got again. did you install tensorflow ? if u did it then please tell me the command.

@zimzamyoyoman
Copy link

Hey, this is because the latest version of openCV doesn't work with RPi. Instead of pip3 install opencv-python try pip3 install opencv-python==3.4.6.27
You will need to uninstall the latest version first. pip3 uninstall opencv-python
THANKS A TON! THIS WORKED!

@wDove1
Copy link

wDove1 commented Aug 8, 2020

This happens when I try uninstalling any ideas?

pi@raspberrypi:~ $ pip3 uninstall opencv-python
Uninstalling opencv-python-4.1.1.26:
  Would remove:
    /usr/local/lib/python3.7/dist-packages/cv2/*
    /usr/local/lib/python3.7/dist-packages/opencv_python-4.1.1.26.dist-info/*
Proceed (y/n)? y
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.7/shutil.py", line 563, in move
    os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.7/dist-packages/cv2/LICENSE-3RD-PARTY.txt' -> '/tmp/pip-uninstall-wr2v2c8q/usr/local/lib/python3.7/dist-packages/cv2/LICENSE-3RD-PARTY.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 143, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/uninstall.py", line 75, in run
    auto_confirm=options.yes, verbose=self.verbosity > 0,
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 683, in uninstall
    uninstalled_pathset.remove(auto_confirm, verbose)
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_uninstall.py", line 224, in remove
    renames(path, new_path)
  File "/usr/lib/python3/dist-packages/pip/_internal/utils/misc.py", line 280, in renames
    shutil.move(old, new)
  File "/usr/lib/python3.7/shutil.py", line 578, in move
    os.unlink(src)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.7/dist-packages/cv2/LICENSE-3RD-PARTY.txt'

@Rich2020
Copy link

This happens when I try uninstalling any ideas?

pi@raspberrypi:~ $ pip3 uninstall opencv-python
Uninstalling opencv-python-4.1.1.26:
  Would remove:
    /usr/local/lib/python3.7/dist-packages/cv2/*
    /usr/local/lib/python3.7/dist-packages/opencv_python-4.1.1.26.dist-info/*
Proceed (y/n)? y
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.7/shutil.py", line 563, in move
    os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.7/dist-packages/cv2/LICENSE-3RD-PARTY.txt' -> '/tmp/pip-uninstall-wr2v2c8q/usr/local/lib/python3.7/dist-packages/cv2/LICENSE-3RD-PARTY.txt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 143, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/uninstall.py", line 75, in run
    auto_confirm=options.yes, verbose=self.verbosity > 0,
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 683, in uninstall
    uninstalled_pathset.remove(auto_confirm, verbose)
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_uninstall.py", line 224, in remove
    renames(path, new_path)
  File "/usr/lib/python3/dist-packages/pip/_internal/utils/misc.py", line 280, in renames
    shutil.move(old, new)
  File "/usr/lib/python3.7/shutil.py", line 578, in move
    os.unlink(src)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.7/dist-packages/cv2/LICENSE-3RD-PARTY.txt'

It says "permission denied" - you forgot to use sudo:

pip3 uninstall opencv-python

@Getsethi
Copy link

Getsethi commented Apr 7, 2021

ImportError Traceback (most recent call last)
in ()
4 import pybind11
5 import astropy
----> 6 import pygedm

1 frames
/usr/local/lib/python3.7/dist-packages/pygedm/ne2001_wrapper.py in ()
3 from functools import wraps
4 from astropy import units as u
----> 5 from . import dmdsm # f2py FORTRAN object
6 from . import density # f2py FORTRAN object
7

ImportError: /usr/local/lib/python3.7/dist-packages/pygedm/dmdsm.so: undefined symbol: PyCObject_Type

Please help resolve this

@DorineMaillet
Copy link

Update following @Zach-OP advice to stay away from the latest version:
On a Pi4 today :

  • OpenCV 4.1.1.26 KO
  • OpenCV 4.1.0.25 imports properly and seems to run fine so far
    => Install with pip3 install opencv-python==4.1.0.25

Thanks a lot, it still works today and I needed it soooo much !!!!

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