ImportError: No module named cv2
no module named 'cv2 python3
importerror: no module named cv2 mac
from .cv2 import * importerror: no module named cv2
no module named cv2 - raspberry pi
no module named cv2 windows
no module named 'cv2' anaconda
no module named 'cv2' spyder
I've been trying to figure this error out for the past day and I've looked up error messages all over the internet and still can't figure out how to get past this error.
I have OpenCV and cv2 setup on my desktop, but I need to program on my laptop now (for mobile reasons). Unfortunately, even though I have OpenCV downloaded, when I try to import cv2, it gives me the error message, "ImportError: No module named cv2".
The closest I've gotten so far is "locate cv2" which gives me "/usr/lib/python2.7/dist-packages/cv2.so". I then go into the python shell and run "import sys" then "sys.path.append('/usr/lib/python2.7/dist-packages')" which then gives me a True when I ask "'/usr/lib/python2.7/dist-packages' in sys.path". However, when I then try to import cv2, it now returns a new error message of "ImportError: numpy.core.multiarray failed to import". I tried resolving this error, but I had no luck on this either.
I've tried everything on forums and message boards online and can't figure out how to fix this. ANY help would be extremely appreciated, as I need to complete this program by the end of the week.
Another reason might be a missing OpenCV module. On my Mac OSX El Capitan [10.11.2 (15C50)], I had the exact same error with Anaconda install, and this resolved the issue:
conda install opencv
While that helped deal with:
ImportError: No module named cv2
It also introduced the following issue:
ImportError: numpy.core.multiarray failed to import
because somehow the numpy version got switched back to 1.7.0. So performing this, worked:
conda update numpy
import numpy print numpy.__version__ 1.10.2
Now all good.
Python 3 ModuleNotFoundError No module named "cv2", Python 3 ModuleNotFoundError No module named "cv2". Article Creation Python ImportError: numpy.core.multiarray failed to import, 954, 2. ImportError: No module named cv2 It also introduced the following issue: ImportError: numpy.core.multiarray failed to import because somehow the numpy version got
I am currently working with Google VM (ubuntu 14.04). Installing opencv on python3.4 version has been quite a task. I wanted opencv to be installed for python 3.4 but everytime it was getting installed on 2.7 version.
I will share the steps I followed so as to help others on it.
Step 1 Follow all the steps as mentioned on openCv installation part till cmake. Link is given below: https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
Note: Install all the 3 packages mentioned at start. That optional one too..!! And dont forget to change the python version for which you are installing.
sudo apt-get install python3-dev python3-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
Follow step 2 for cmake.
Step 2 For installing opencv in specific version of python (ubuntu), you have to set the default (PYTHON_DEFAULT_EXECUTABLE) with the path to where your python is installed. You can find that out by using command whereis python3.4 (or, your version). Mine was in /usr/bin/python3.4
Instead of cmake mentioned on the page, use this,
cmake -D CMAKE_BUILD_TYPE=Release -D BUILD_NEW_PYTHON_SUPPORT=ON -D BUILD_opencv_python3=ON -D HAVE_opencv_python3=ON -D PYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3.4 ..
Note: Dont forget to change your python version and path in PYTHON_DEFAULT_EXECUTABLE.
Step 3 Follow the remaining steps as mentioned in the link till sudo make install
Hope it helps.
what's cv2 and how to install it (i had run 'pip install cv2 --user , File "download_videos.py", line 6, in import cv2 ImportError: No module named cv2 envy@ub1404:~/os_pri/github/video_to_sequence$ No module named 'cv2' Ask Question Asked 2 years, 7 months ago. ImportError: No module named requests. 265. Cannot find module cv2 when using OpenCV. 0
You're missing NumPy, which can be installed one of several ways. Here's some possibilities, listed in order of (my personal) preference:
1) Inside a virtualenv. See https://stackoverflow.com/a/19213369/1510289 on how to do this.
2) System-wide, if you have pip installed:
pip install numpy
3) System-wide, using your package manager. For example on Ubuntu:
apt-get install python-numpy
or on YUM systems, like Fedora:
yum install numpy
ImportError: No module named cv2 � Issue #230 � experiencor/keras , File "/Users/(my username)/Desktop/git_repo/keras-yolo2/preprocessing.py", line 2, in import cv2 ImportError: No module named cv2. Any idea� ImportError: No module named cv2 #230. Closed IMABUNNEH opened this issue Apr 10, 2018 · 4 comments Closed ImportError: No module named cv2 #230.
Python ImportError: No module named cv2, Please try again later. Published on Mar 16, 2018. How to fix Python ImportError: No module Duration: 1:36 Posted: 16-Mar-2018 ImportError: No module named 'cv2' in Ubuntu 16.04 for Python3 in OpenCV3 #7045. Closed monajalal opened this issue Aug 5, 2016 · 4 comments Closed
ImportError: No module named cv2, How to fix Python ImportError: No module named cv2 apt get install python- opencv pip Duration: 2:39 Posted: 16-Mar-2018 cv2.so and cv.py are present on the system, but if I run python: >>> import cv Traceback (most recent call last): File "<stdin>", line 1, in <module> File "cv.py", line 1, in <module> from cv2.cv import * ImportError: No module named cv >>> import cv2 >>> cv2 imports, but no cv. If I try to run thumbor, local_detector.py throws
In Python ,After installing pip Install python-opencv module , still the , ImportError: No module named cv2 I'm pretty new to this and maybe this might be an easy question but I can't seem to import cv2 with the code in the tutorial. If you really sure that you installed cv2 but it gives no module error. There is a solution for this. Probably you have cv2.so file in your directory /usr/local/lib/python2.7/site-packages/cv2.so move this cv2.so file to /usr/lib/python2.7/site-packages copy the file into site-packages directory
- what os? maybe you installed version for python 3 but you use python 2, or opposite?
- is numpy installed on your laptop?
- @Marcin: I have Ubuntu 14.04 running. When I do "python --version" it returns python 2.7.9. However, when I go into "/usr/lib/", I see both Python2.7, Python3, and Python3.4.
- @Mailerdaimon I believe so, but I have no idea how to check.
- I have already tried 2 and 3. 2 returns "Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/lib/python2.7/dist-packages" 3 returns "0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded." Based on that, I presume that this means that numpy is already installed system-wide. I could try the virtualenv, but I prefer to have it system-wide.
- It sounds like your NumPy version is outdated. Try doing what it says: For 2) try
pip install --upgrade numpy, and for 3) try
apt-get update; apt-get upgrade.
- I just did your two suggestions for 2 and 3. Now, when I try to import numpy in the python shell, it returns "Import Error: /usr/lib/python2.7/dist-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS4_AsUnicodeEscapeString".
- It sounds like you got different versions of numpy mixed together, the one installed with
pipand the other with
apt-get. Let's try fixing this by just focusing on method #3 and forget method #2. So, first remove the one you installed with pip:
pip uninstall numpyand then try importing the module from python shell.
- I tried that and it didn't work. However, I uninstalled Ubuntu and did a clean re-install, following only these instructions and it worked.