ModuleNotFoundError No module named cv2

+2 votes

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,230 points
265,124 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,440 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 11, 2020 by anonymous
• 82,880 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,910 points
4,090 views
0 votes
1 answer

modulenotfounderror: no module named 'cv2'

Firstly, please do run these following commands ...READ MORE

answered Feb 8, 2022 in Python by Soham
• 9,700 points
2,149 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
76,791 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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,023 views
0 votes
1 answer
+5 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,790 points
3,411 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,440 points
27,301 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP