ai-forever / Kandinsky-2

Kandinsky 2 — multilingual text2image latent diffusion model
Apache License 2.0
2.77k stars 309 forks source link

No module named cv2 #5

Open erelsgl opened 1 year ago

erelsgl commented 1 year ago

I installed Kandinsky according to the instructions:

PS D:\> pip install "git+https://github.com/ai-forever/Kandinsky-2.0.git"
Collecting git+https://github.com/ai-forever/Kandinsky-2.0.git
  Cloning https://github.com/ai-forever/Kandinsky-2.0.git to c:\users\erel segal-halevi\appdata\local\temp\pip-req-build-o452dzak
  Running command git clone --filter=blob:none --quiet https://github.com/ai-forever/Kandinsky-2.0.git 'C:\Users\Erel Segal-Halevi\AppData\Local\Temp\pip-req-build-o452dzak'
  Resolved https://github.com/ai-forever/Kandinsky-2.0.git to commit 140d16db59d409f45f0e5ae755804ebe8f4b5a0a
  Preparing metadata (setup.py) ... done
Requirement already satisfied: Pillow in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (9.4.0)
Requirement already satisfied: attrs in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (22.2.0)
Requirement already satisfied: torch in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (1.13.1)
Requirement already satisfied: filelock in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (3.9.0)
Requirement already satisfied: requests in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (2.28.2)
Requirement already satisfied: tqdm in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (4.64.1)
Requirement already satisfied: ftfy in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (6.1.1)
Requirement already satisfied: regex in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (2022.10.31)
Requirement already satisfied: numpy in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (1.24.2)
Requirement already satisfied: blobfile in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (2.0.1)
Requirement already satisfied: transformers==4.23.1 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (4.23.1)
Requirement already satisfied: torchvision in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (0.14.1)
Requirement already satisfied: omegaconf in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (2.3.0)
Requirement already satisfied: pytorch_lightning in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (1.9.3)
Requirement already satisfied: einops in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (0.6.0)
Requirement already satisfied: sentencepiece in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from kandinsky2==0.0.0) (0.1.97)
Requirement already satisfied: tokenizers!=0.11.3,<0.14,>=0.11.1 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from transformers==4.23.1->kandinsky2==0.0.0) (0.13.2)
Requirement already satisfied: huggingface-hub<1.0,>=0.10.0 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from transformers==4.23.1->kandinsky2==0.0.0) (0.12.1)
Requirement already satisfied: packaging>=20.0 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from transformers==4.23.1->kandinsky2==0.0.0) (23.0)
Requirement already satisfied: pyyaml>=5.1 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from transformers==4.23.1->kandinsky2==0.0.0) (6.0)
Requirement already satisfied: colorama in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from tqdm->kandinsky2==0.0.0) (0.4.6)
Requirement already satisfied: lxml~=4.9 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from blobfile->kandinsky2==0.0.0) (4.9.2)
Requirement already satisfied: pycryptodomex~=3.8 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from blobfile->kandinsky2==0.0.0) (3.17)
Requirement already satisfied: urllib3<3,>=1.25.3 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from blobfile->kandinsky2==0.0.0) (1.26.14)
Requirement already satisfied: wcwidth>=0.2.5 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from ftfy->kandinsky2==0.0.0) (0.2.6)
Requirement already satisfied: antlr4-python3-runtime==4.9.* in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from omegaconf->kandinsky2==0.0.0) (4.9.3)
Requirement already satisfied: torchmetrics>=0.7.0 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from pytorch_lightning->kandinsky2==0.0.0) (0.11.3)
Requirement already satisfied: fsspec[http]>2021.06.0 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from pytorch_lightning->kandinsky2==0.0.0) (2023.1.0)
Requirement already satisfied: lightning-utilities>=0.6.0.post0 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from pytorch_lightning->kandinsky2==0.0.0) (0.7.1)
Requirement already satisfied: typing-extensions>=4.0.0 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from pytorch_lightning->kandinsky2==0.0.0) (4.5.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from requests->kandinsky2==0.0.0) (2022.12.7)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from requests->kandinsky2==0.0.0) (3.0.1)
Requirement already satisfied: idna<4,>=2.5 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from requests->kandinsky2==0.0.0) (3.4)
Requirement already satisfied: aiohttp!=4.0.0a0,!=4.0.0a1 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from fsspec[http]>2021.06.0->pytorch_lightning->kandinsky2==0.0.0) (3.8.4)
Requirement already satisfied: aiosignal>=1.1.2 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>2021.06.0->pytorch_lightning->kandinsky2==0.0.0) (1.3.1)
Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>2021.06.0->pytorch_lightning->kandinsky2==0.0.0) (4.0.2)
Requirement already satisfied: yarl<2.0,>=1.0 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>2021.06.0->pytorch_lightning->kandinsky2==0.0.0) (1.8.2)
Requirement already satisfied: frozenlist>=1.1.1 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>2021.06.0->pytorch_lightning->kandinsky2==0.0.0) (1.3.3)
Requirement already satisfied: multidict<7.0,>=4.5 in c:\users\erel segal-halevi\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]>2021.06.0->pytorch_lightning->kandinsky2==0.0.0) (6.0.4)

Then I tried to import it in Python but got an error:

PS D:\> python
Python 3.10.10 (tags/v3.10.10:aad5f6a, Feb  7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from kandinsky2 import get_kandinsky2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Erel Segal-Halevi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\kandinsky2\__init__.py", line 2, in <module>
    from .kandinsky2_model import Kandinsky2
  File "C:\Users\Erel Segal-Halevi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\kandinsky2\kandinsky2_model.py", line 4, in <module>
    import cv2
ModuleNotFoundError: No module named 'cv2'
erelsgl commented 1 year ago

I did pip install opencv-python and now the error message is gone, though I have other problems. I do not know if this is the correct solution. If it is, then I suggest to add opencv-python to requirements.txt.

ahmad88me commented 7 months ago

@erelsgl thanks for the pointer. I added it to the requirements. https://github.com/ai-forever/Kandinsky-2/pull/101