CompVis / stable-diffusion

A latent text-to-image diffusion model
https://ommer-lab.com/research/latent-diffusion-models/
Other
67.95k stars 10.12k forks source link

import cv2 ModuleNotFoundError: No module named 'cv2' #287

Open YanyUUZ opened 2 years ago

YanyUUZ commented 2 years ago

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

NickelCoating commented 2 years ago

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...

jdagdelen commented 2 years ago

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?

Cyberes commented 2 years ago

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.

Elbekay007 commented 1 year ago

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 ?

jdagdelen commented 1 year ago
  1. Check your Python version.
  2. Check you followed installation instructions.

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