stable-diffusion icon indicating copy to clipboard operation
stable-diffusion copied to clipboard

import cv2 ModuleNotFoundError: No module named 'cv2'

Open YanyUUZ opened this issue 3 years ago • 3 comments

Traceback (most recent call last): File "scripts/txt2img.py", line 2, in import cv2 ModuleNotFoundError: No module named 'cv2'

YanyUUZ avatar Sep 16 '22 17:09 YanyUUZ

It works for me now but I do not really know how. Perhaps because of pip install -e that I skipped since it sounded optional where it says:

you can also update an existing latent diffusion environment by running

And then follows with this:

conda install pytorch torchvision -c pytorch
pip install transformers==4.19.2 diffusers invisible-watermark
pip install -e .

I only used pip install -e . alone later.

I am using PopOS. Its console prints the python environment you are in at the very beginning of the console line. So make sure that you use LDM with conda activate ldm that is my point. You need to be in that environment since Python is not a real programming language.

Such issues could be avoided by using a real programming language (compiled language instead interpreted) for CLI (Command Line Interface) applications.

If you want SD to use another language and it does not have to be Rust. Then perhaps let the developers know on my rather long rant about this issue: https://github.com/CompVis/stable-diffusion/issues/283

Neither the dreaded C++ does force you to jump through so many hoops just to run a simple app...

NickelCoating avatar Sep 17 '22 20:09 NickelCoating

Traceback (most recent call last): File "scripts/txt2img.py", line 2, in import cv2 ModuleNotFoundError: No module named 'cv2'

Did you install the requirements or create a conda environment as specified?

jdagdelen avatar Sep 17 '22 22:09 jdagdelen

If you want SD to use another language and it does not have to be Rust. Then perhaps let the developers know on my rather long rant about this issue: #283

If you want to stick with Python and it does not have to be C# or Java. Then why did you even bother asking me? Go ask someone who actually has experience in both. And now I am done. This was just to show how idiotic people can be when they do not know what they are talking about. I do not know any other language than C#. But from what I heard from friends of mine (who had to use it for work) and from some talks about it online it seems to be nothing but an overcomplicated mess.

Cyberes avatar Sep 27 '22 19:09 Cyberes

Traceback (most recent call last): File "afy/cam_fomm.py", line 8, in import cv2 ModuleNotFoundError: No module named 'cv2'

I have been stuck here for 3 days, can someone help me out please ?

Elbekay007 avatar Dec 23 '22 11:12 Elbekay007

  1. Check your Python version.
  2. Check you followed installation instructions.

this error says you don’t have one of the required libraries installed

jdagdelen avatar Dec 23 '22 17:12 jdagdelen