Importing openCV in python idle error: shared object file
I have been trying to use the cv2 library in python (in IDLE on raspberry pi 3) but I can't manage to import it successfully.
when I type import cv2, I get this:
Traceback (most recent call last): File "/home/pi/Desktop/python/test.py", line 2, in <module> from .cv2 import * ImportError: libjasper .so.1: cannot open shared object file: No such file or directory
I have used the terminal to update, upgrade, and install opencv along with pretty much every other thing I could find relating to opencv or lib. I currently can import cv2 in the terminal but not in IDLE. What do I need to do to be able to import the cv2 library? Thanks in advance.
Follow the commands for opencv and face recognition : (it worked for me)
-> sudo apt update -> sudo apt upgrade -> sudo apt-get install python3-pip pi@raspberrypi:~ $ python3 -V Python 3.5.3 pi@raspberrypi:~ $ python2 -V Python 2.7.13 -> pip3 install numpy -> pip3 install pillow -> pip3 install dlib -> sudo apt-get install cmake -> pip3 install face_recognition -> sudo apt-get install python-opencv -> sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev -> sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev -> sudo apt-get install libatlas-base-dev -> sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev -y -> sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev -y -> sudo apt-get install libgtk2.0-dev libgtk-3-dev -y -> sudo pip3 install opencv-python -> sudo apt-get install libavformat-dev libswscale-dev openexr libopenexr-dev -> sudo apt-get install libqt4-dev -> sudo apt-get install libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev pi@raspberrypi:~ $ python3 Python 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> import dlib >>> import face_recognition >>>
Importing openCV in python idle error: shared object file, import * ImportError: libjasper .so.1: cannot open shared object file: No such file or directory I have used the terminal to update, upgrade, and install opencv ImportError: libopencv_hdf3.so.3.3: cannot open shared object file: No such file or directory please help me resolve this issue edit retag flag offensive close merge delete
As discussed here, below installations seemed to resolve the issue. It worked for me.
pip3 install opencv-python sudo apt-get install libatlas-base-dev sudo apt-get install libjasper-dev sudo apt-get install libqtgui4 sudo apt-get install python3-pyqt5 sudo apt-get install libqt4-test
Import Error: cannot import name 'cv2', pip uninstall opencv-python opencv-contrib-python. Also, can you try You'll also have to locate the two .dll files in the bin folder of your opencv folder. And copy I also tried installing opencv right after numpy, matplotlib, jupyter and it worked too. Thank you! I don't know what caused that exactly but, in the issue I mentioned, when I tried to install opencv I got. opencv: 3.4.1-py36h6fd60c2_3 instead of. opencv: 3.4.1-py36_blas_openblash829a850_201 conda-forge [blas_openblas]
Recommended way of installing opencv on linux as given by opencv docs "https://docs.opencv.org/4.2.0/d2/de6/tutorial_py_setup_in_ubuntu.html" for python3 is:
sudo apt install python3-opencv
sudo apt install python-opencv
On Raspberry pi you may occasionally need to run:
sudo apt update --fix-missing
It will auto-install all the dependencies.
Ubuntu 18.04: How to install OpenCV, Ubuntu 16.04: How to install OpenCV with Python 2.7 and Python 3.5+ OpenCV is an image processing/computer vision library and therefore it needs to be able to load standard image file @Zubair Ahmad shared a link that is not working for my case. how i can to import cv2 module from python idle? I don't have much experience of running the code on docker, I am very new to docker. I am trying to run my deep learning model on docker. I am using OpenCV for some initial image processing. Th
Ubuntu 16.04: How to install OpenCV, Inside this tutorial, I will document, demonstrate, and provide detailed steps to Note: If you do not install the Python development headers and static library, you'll a lot of previous experience compiling OpenCV, if you do run into an error, Q. When I (1) open up a Python shell that imports OpenCV or (2) I am sorry that : I have usepip install opencv_contrib_python-188.8.131.52-cp35-cp35m-linux_armv7l.whl and It seems OK, but when I python import cv2 It told me that:Traceback (most recent call last): File "<stdin>", line 1, in <module> File "
Cant Import cv2 (Pi 3 Mobel B) Python 3.5, For now Im trying to remove this error on following code, but it does import cv2 import numpy as np import time #Open Camera object cap = cv2. pi@raspberrypi:~ $ sudo apt-get install python-opencv Reading package lists. from .cv2 import * ImportError: libQtTest.so.4: cannot open shared object file: pip uninstall opencv-python or. pip3 uninstall opencv-python Only then will opencv work for both python2 and python3 on your rasphberry pi.
Install OpenCV-Python in Ubuntu, In this tutorial We will learn to setup OpenCV-Python in Ubuntu System. Open Python IDLE (or IPython) and type following codes in Python terminal. latest version will always contain much better support and latest bug fixes. If you want to get latest libraries, you can install development files for system libraries of these Note as a common practice, we activate virtual env for a specific version of python (e.g. py36) first. @alalek It was really frustrating that I found no env computed routine for python during checking the source of installation files.