TensorFlow-Object-Detection-on-the-Raspberry-Pi icon indicating copy to clipboard operation
TensorFlow-Object-Detection-on-the-Raspberry-Pi copied to clipboard

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

Open happy-little-zhang opened this issue 6 years ago • 41 comments
trafficstars

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

happy-little-zhang avatar Nov 20 '19 04:11 happy-little-zhang

rp3b+,same error.

mentianyi avatar Nov 21 '19 05:11 mentianyi

Same error using Raspbian Buster

saifsmailbox98 avatar Nov 21 '19 18:11 saifsmailbox98

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.

saifsmailbox98 avatar Nov 21 '19 18:11 saifsmailbox98

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

mentianyi avatar Nov 22 '19 08:11 mentianyi

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?

saifsmailbox98 avatar Nov 22 '19 17:11 saifsmailbox98

I'm seeing this as well.

Zach-OP avatar Nov 22 '19 20:11 Zach-OP

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

Zach-OP avatar Nov 22 '19 20:11 Zach-OP

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 avatar Nov 24 '19 07:11 happy-little-zhang

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

happy-little-zhang avatar Nov 24 '19 07:11 happy-little-zhang

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

jlbs86 avatar Dec 02 '19 06:12 jlbs86

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?

ueray avatar Dec 18 '19 09:12 ueray

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 !!!

Pupan-cpe avatar Dec 25 '19 17:12 Pupan-cpe

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 😭

insung3511 avatar Jan 01 '20 11:01 insung3511

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

deysarkarswarup avatar Jan 08 '20 17:01 deysarkarswarup

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!

andromeda1998 avatar Jan 27 '20 05:01 andromeda1998

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

vietanha74 avatar Feb 03 '20 14:02 vietanha74

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

Riverlox12 avatar Feb 09 '20 11:02 Riverlox12

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

modarm-e avatar Feb 16 '20 07:02 modarm-e

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 !

gdoise avatar Feb 20 '20 10:02 gdoise

rp3b+,same error.

Use OpenCV contrib with the right version.

pip install opencv-contrib-python==4.1.0.25

svsadafule avatar Feb 27 '20 04:02 svsadafule

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

bharath-velisala avatar Feb 27 '20 18:02 bharath-velisala

Okay thank you very much! Have a great day!

On Sun, Feb 16, 2020, 1:16 AM modarm-e [email protected] wrote:

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/issues/67?email_source=notifications&email_token=ANXCQKELI5E4DJX4YB2YJ6DRDDR53A5CNFSM4JPNARM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL37TKI#issuecomment-586676649, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANXCQKDEJXGAVBPC4243DL3RDDR53ANCNFSM4JPNARMQ .

Riverlox12 avatar Feb 28 '20 00:02 Riverlox12

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

Edwiinrtz avatar Mar 07 '20 06:03 Edwiinrtz

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

harshbhatt99 avatar Mar 27 '20 09:03 harshbhatt99

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

Martink-NZ avatar Apr 04 '20 03:04 Martink-NZ

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

Pupan-cpe avatar Apr 14 '20 18:04 Pupan-cpe

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 avatar May 03 '20 09:05 shubhamkhandhar

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

shubhamkhandhar avatar May 03 '20 11:05 shubhamkhandhar

$ 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.

60999 avatar May 06 '20 09:05 60999

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

yoher avatar May 14 '20 01:05 yoher