I'm trying to import cv2 on Jupyter notebook but I get this error:
ImportError: No module named cv2
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 missing ?
(I'm using windows 10 and working with microsoft cognitives api, that's why I need to import this package.)
here is the code:
<ipython-input-1-9dee6ed62d2d> in <module>()
----> 1 import cv2
2 cv2.__version__
What should I do in order to make this work ?
You will now be able to import OpenCV to your jupyter notebook. One of possibility is that you could have written import cv2 and its utilisation in separate cells of jupyter notebook.If this is the case then first run the cell having import cv2 part and then run the cell utilising the cv2 library.
Problem : Import on Jupyter notebook failed where command prompt works. Reason : This problem usually occurs when your cmd prompt is using different python and Anaconda/jupyter is using different. Run this code in cmd prompt and jupyter notebook and note the output paths.
No module named 'cv2' in jupiter notebook modulenotfounderror: The specified module cannot be found.
Check python version on your terminal/cmd/powershell. Check version on your Jupyter notebook. They both need to be the same. In order to check whether you are having module installed. Type help ('modules'), and find the module you are trying to work with.
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
Is the cv2
module located in any of those directories? If not your path is looking in the wrong place. If it is overlooking the install location, append it to your python path. You can follow the instructions here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With