ModuleNotFoundError No module named cv2

+1 vote

Hi Guys,

I am getting this below error when I tried to import cv2 module in jupyter notebook.

import cv2
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-c8ec22b3e787> in <module>
----> 1 import cv2
ModuleNotFoundError: No module named 'cv2'

How can I import cv2?

Thank You

Apr 9, 2020 in Python by akhtar
• 38,170 points
63,757 views

3 answers to this question.

+1 vote
Best answer

Hi@akhtar,

This error may occur if you didn't install opencv module in your system. So first check this module is available or not.

$ pip list or conda list

If it is not available, then install this module.

$ pip install opencv-python or conda install opencv-python

But before that, try to check numpy module is available or not. If numpy is not available, then install this first.

$ pip install numpy

Hope this will solve your error.

answered Apr 9, 2020 by MD
• 95,160 points

selected Nov 25, 2020 by akhtar
i have both opencv-python and numpy  in my pip3 list bust still the error exist please help me thanks in advance:)

Uninstall opencv-python and numpy first and upgrade your pip using the below command.

$ pip install --upgrade pip

After this, reinstall your software.

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-c72f46167913> in <module>
----> 1 import cv2
      2 import time
      3 import numpy as np

ModuleNotFoundError: No module named 'cv2'


 I tried: 
pip install opencv-python or conda install opencv-python
then,
ERROR: Could not find a version that satisfies the requirement or (from versions: none)
ERROR: No matching distribution found for or
0 votes

First do run these commands inside Terminal/CMD:

conda update anaconda-navigator  
conda update navigator-updater  

Then the issue for the instruction below will be resolved

For windows if you have anaconda installed, you can simply do

pip install opencv-python

or

conda install -c https://conda.binstar.org/menpo opencv

if you are on linux you can do :

pip install opencv-python

or

conda install opencv 

Update:
if you use anaconda, you may simply use this as well (and hence don't need to add menpo channel):

conda install -c conda-forge opencv
answered Aug 17, 2020 by pakainfo
• 200 points
I got this same problem and I could not get solved by this method. My pycharm is saying this same error still now........

Hi@IA4,

You need to check the environment properly. You may have a CV2 module in a different environment. Also, restart the IDE after the successful installation.

0 votes

If you want as simple as possible, install from the repository:

sudo apt-get install python-opencv libopencv-dev python-numpy python-dev
answered Dec 10, 2020 by anonymous
• 82,720 points

Related Questions In Python

0 votes
1 answer

ModuleNotFoundError: No module named 'cv2'

Check if it's installed properly, It will work ...READ MORE

answered Oct 12, 2020 in Python by Gitika
• 65,870 points
906 views
+1 vote
3 answers
+2 votes
3 answers

ModuleNotFoundError: No module named 'Crypto'

The module you’ve installed is different. To install ...READ MORE

answered Aug 20, 2019 in Python by Raman
31,064 views
0 votes
2 answers

ModuleNotFoundError: No module named 'pythoncom' in pyttsx3

even i faced the same problem ...just ...READ MORE

answered Jun 2, 2020 in Python by anonymous
6,413 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,032 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
1,554 views
0 votes
1 answer
+2 votes
2 answers

ModuleNotFoundError: No module named 'pyttsx3

Hi@akhtar, To avoid this error you have to ...READ MORE

answered Apr 24, 2020 in Python by MD
• 95,160 points
7,505 views