Import OpenCV on jupyter notebook

how to install opencv in anaconda
pip install opencv
opencv jupyter notebook tutorial
install opencv python3
unable to install opencv in anaconda
conda install menpo opencv
how to install opencv in jupyter notebook ubuntu
pypy opencv

I tried installing OpenCV on Windows 10 using pip. I used this command- pip install opencv-contrib-python

After that when I tried importing cv2 on command prompt, it was successfully imported-

When I tried importing it on jupyter notebook, this error popped up-

This is the python version I'm using-

This is pip list and as I've highlighted, opencv-contrib-python version 3.4.3.18 is installed-

Then why can't I import OpenCV on jupyter notebook, like tensorflow or numpy are also in pip list and I'm able to import them both through command prompt and also on jupyter notebook.

Please help. Thanks a lot.

You have installed openCV in Python running on your Terminal, not into the working environment which Jupyter Notebooks is running from.

Whilst in Terminal write:

py -m pip install opencv-python

When you use pip list

You should see opencv-python 3.4.3.18

More information here.

cv2 import error on Jupyter notebook, Is your python path looking in the right place? Check where python is looking for the module. Within the notebook try: import os os.sys.path. For those of you who are trying to use OpenCV in a Jupyter notebook, it may be frustrating that you can’t do imshow out of the box. It is so easy from the interactive shell, but you still want to…

You should open the anaconda prompt and then type:

conda install opencv 

It should work.

cv2 import issue in jupyter notebook, but works in python cli inside , When I ran first cell on Notebook 1, I got the following error: ModuleNotFoundError: No module named 'cv2' But when I enter python cli within​  After that OpenCV was installed and I could import it on command prompt but not on jupyter notebook. Later I opened Anaconda prompt, and typed- pip install opencv and it worked. But it's in my root environment.

It seems like you run jupyter not from conda environment, that has opencv module installed. try to do this: conda activate <your environment>

conda install jupyter
jupyter notebook

after that try to "import cv2"

Getting Started with OpenCV: Installing OpenCV on Windows using , Now, you will be able to install Anaconda on your system. 2. Installing required packages (including Jupyter Notebook and OpenCV). 2. After  If you have already installed opencv, then its possible that your notebook and your opencv library are in 2 different python environments. The following has helped me in the past: Open your notebook; In an new cell type:!pip install opencv-python. Note, that the ! is deliberate. This will install open-cv in your current notebook environment.

OpenCV-Python – How to install OpenCV-Python package to , is shipped with tons of useful packages, such as NumPy, Pandas, IPython Notebook, etc. To confrim that Anaconda is now able to import the OpenCV-​Python package (namely, cv2 ), issue these in the IPython Console: This brief tutorial covers instructions for: Installing Anaconda for Windows Installing Jupyter Notebook, OpenCV, and other required packages Implementing image blending using OpenCV 1.

How to use OpenCV imshow() in a Jupyter Notebook, For those of you who are trying to use OpenCV in a Jupyter notebook, it may be frustrating that you can't do imshow out of the box. It is so easy  Browse other questions tagged python macos opencv ipython jupyter-notebook or ask your own question. The Overflow Blog Podcast 226: Programming tutorials can be a real drag

Exploring Jupyter Notebook, Jupyter Notebook is a really nice way of creating interactive code and widgets. We're going to import OpenCV, TensorFlow, dlib, and Tesseract, just to make  I'm trying to import cv2 on Jupyter notebook but I get this error: I am frustrated because I'm working on this simple issue for hours now. it works on Pycharm but not on Jupiter notebook. I've already installed cv2 into Python2.7's site packages, configured Jupyter's kernel to python2, browsed the documentation but I still don't get what I am

Comments
  • Please show the output of import sys; print(sys.prefix) for both the cmdline python and your notebook python.
  • Are you sure you installed opencv in the same virtual environment you are using with Jupyer?
  • Hello Deets, thanks for replying. On cmdline, output is- C:\ProgramData\Anaconda3 On jupyter notebook, output is- C:\Users\HP\Anaconda3
  • Hello Ed. Thanks for replying. Earlier when I installed tensorflow, I used- pip install tensorflow and after that I could import tensorflow both on command prompt and on Jupyter notebook. Then why for OpenCV, I'm facing this problem?
  • Hello Michael. Thank for replying. I was wondering that where exactly did I install OpenCV then. What does pip list show? I mean, I am able to import cv2 on command prompt, but not on python shell and neither on jupyter notebook. So is it like command prompt, anaconda jupyter notebook and python shell independent of each other?
  • It would have been installed into your Python Shell. So you could work with opencv2 within the Python PATH. Jupyter needs you to install it into your Windows CMD, to access that module. Though I must confess I am sure someone else more technically minded is better able to answer that question. Also I'm fairly sure the library you installed is not OpenCV but a module for contributing to open CV. See here: github.com/opencv/opencv_contrib