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
Link1 Link2
For python3.5+ check these links : Link3 , Link4
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
Answer from Hossein on Stack OverflowFirst 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
Link1 Link2
For python3.5+ check these links : Link3 , Link4
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
This happens when python cannot refer to your default site-packages folder where you have kept the required python files or libraries
Add these lines in the code:
import sys
sys.path.append('/usr/local/lib/python2.7/site-packages')
or before running the python command in bash move to /usr/local/lib/python2.7/site-packages directory. This is a work around if you don't want to add any thing to the code.
» pip install opencv-python
Pip install works but I can't import "Fer and CV2"
Issue "ModuleNotFoundError: No module named 'cv2'" although opencv is installed
Installed opencv but having trouble importing it
How do I fix the issue moduleNotFoundError: No module named 'cv2' ?
Videos
Normally I would just look up the solution rather than ask but from what I've seen, most people tend to have this issue differently, hence why I needed to ask, but also because I'm completely ignorant on this matter. I don't think I could fix this on my own unless I found an answer that told me how step by step.
Anyway, as I was installing diffusions for the very first time, the cmd kept giving me this issue repeatedly.
Relauncher: Launching...
Traceback (most recent call last):
File "scripts/webui.py", line 18, in <module>
import cv2
ModuleNotFoundError: No module named 'cv2'
As I've said above, since I'm ignorant on this topic, I have no idea what that really means or how to fix it so any help would really be great. I really don't want several hours to be wasted on this lol
1)Delete all your existing opencv installation
2) Reinstall it again in that way (python 3)
python -m pip install opencv-python
3) And Voila!
> import cv2
> sift = cv2.xfeatures2d.SIFT_create()
There is 2 possible problems about ModuleNotFoundError: No module named 'cv2'.
find the cv2.so file and move it into usr/local/lib/python3.6/site-packages
find / -name 'cv2.so'possible output /usr/local/lib/python3.6/site-packages/cd /usr/local/lib/python3.6/site-packages/cp cv2.so /usr/lib/python3.6/site-packages/then quit the terminal and rerun it.
vi /etc/profileedit the profile and addexport PYTHONPATH=/usr/local/lib/python3.6/site-packages:$PYTHONPATHto the last line.