AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
139.56k stars 26.46k forks source link

[Bug]: AttributeError: module 'cv2' has no attribute 'INTER_AREA' #14023

Closed tetshuna closed 9 months ago

tetshuna commented 10 months ago

Is there an existing issue for this?

What happened?

the program does not start

Steps to reproduce the problem

run Stable Diffusion

What should have happened?

run

Sysinfo

{ "Platform": "Windows-10-10.0.19045-SP0", "Python": "3.10.6", "Version": "v1.6.0-2-g4afaaf8a", "Commit": "4afaaf8a020c1df457bcf7250cb1c7f609699fa7", "Script path": "E:\AUTOMATIC1111\webui", "Data path": "E:\AUTOMATIC1111\webui", "Extensions dir": "E:\AUTOMATIC1111\webui\extensions", "Checksum": "4ff0a53592f5cf2720f03842feb846231f3f7b7ad7dd944240b00d14eeea8782", "Commandline": [ "launch.py", "--autolaunch", "--update-check", "--no-half-vae", "--xformers", "--dump-sysinfo" ], "Torch env info": { "torch_version": "2.0.1+cu118", "is_debug_build": "False", "cuda_compiled_version": "11.8", "gcc_version": null, "clang_version": null, "cmake_version": null, "os": "Microsoft Windows 10 Pro", "libc_version": "N/A", "python_version": "3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] (64-bit runtime)", "python_platform": "Windows-10-10.0.19045-SP0", "is_cuda_available": "True", "cuda_runtime_version": null, "cuda_module_loading": "LAZY", "nvidia_driver_version": "546.01", "nvidia_gpu_models": "GPU 0: NVIDIA GeForce RTX 2080", "cudnn_version": null, "pip_version": "pip3", "pip_packages": [ "numpy==1.23.5", "open-clip-torch==2.20.0", "pytorch-lightning==1.9.4", "torch==2.0.1+cu118", "torchdiffeq==0.2.3", "torchmetrics==1.0.3", "torchsde==0.2.5", "torchvision==0.15.2+cu118" ], "conda_packages": null, "hip_compiled_version": "N/A", "hip_runtime_version": "N/A", "miopen_runtime_version": "N/A", "caching_allocator_config": "", "is_xnnpack_available": "True", "cpu_info": [ "\"wmic\" non è riconosciuto come comando interno o esterno,", " un programma eseguibile o un file batch." ] }, "Exceptions": [], "CPU": { "model": "Intel64 Family 6 Model 158 Stepping 12, GenuineIntel", "count logical": 8, "count physical": 8 }, "RAM": { "total": "16GB", "used": "9GB", "free": "7GB" }, "Extensions": [], "Inactive extensions": [], "Environment": { "COMMANDLINE_ARGS": "--autolaunch --update-check --no-half-vae --xformers --dump-sysinfo", "GRADIO_ANALYTICS_ENABLED": "False" }, "Config": "'NoneType' object has no attribute 'data'", "Startup": null, "Packages": [ "absl-py==1.4.0", "accelerate==0.21.0", "addict==2.4.0", "aenum==3.1.15", "aiofiles==23.2.1", "aiohttp==3.8.5", "aiosignal==1.3.1", "altair==5.0.1", "antlr4-python3-runtime==4.9.3", "anyio==3.7.1", "async-timeout==4.0.3", "attrs==23.1.0", "basicsr==1.4.2", "beautifulsoup4==4.12.2", "blendmodes==2022", "boltons==23.0.0", "cachetools==5.3.1", "certifi==2023.7.22", "cffi==1.15.1", "charset-normalizer==3.2.0", "clean-fid==0.1.35", "click==8.1.7", "clip==1.0", "colorama==0.4.6", "contourpy==1.1.0", "cssselect2==0.7.0", "cycler==0.11.0", "deprecation==2.1.0", "dynamicprompts==0.30.4", "einops==0.4.1", "exceptiongroup==1.1.3", "facexlib==0.3.0", "fastapi==0.94.0", "ffmpy==0.3.1", "filelock==3.12.2", "filterpy==1.4.5", "flatbuffers==23.5.26", "fonttools==4.42.0", "frozenlist==1.4.0", "fsspec==2023.6.0", "ftfy==6.1.1", "future==0.18.3", "fvcore==0.1.5.post20221221", "gdown==4.7.1", "gfpgan==1.3.8", "gitdb==4.0.10", "gitpython==3.1.32", "google-auth-oauthlib==1.0.0", "google-auth==2.22.0", "gradio-client==0.5.0", "gradio==3.41.2", "grpcio==1.57.0", "h11==0.12.0", "httpcore==0.15.0", "httpx==0.24.1", "huggingface-hub==0.16.4", "idna==3.4", "imageio==2.31.1", "importlib-metadata==6.8.0", "importlib-resources==6.0.1", "inflection==0.5.1", "iopath==0.1.9", "jinja2==3.1.2", "jsonmerge==1.8.0", "jsonschema-specifications==2023.7.1", "jsonschema==4.19.0", "kiwisolver==1.4.4", "kornia==0.6.7", "lark==1.1.2", "lazy-loader==0.3", "lightning-utilities==0.9.0", "linkify-it-py==2.0.2", "llvmlite==0.40.1", "lmdb==1.4.1", "lpips==0.1.4", "lxml==4.9.3", "markdown-it-py==2.2.0", "markdown==3.4.4", "markupsafe==2.1.3", "matplotlib==3.7.2", "mdit-py-plugins==0.3.3", "mdurl==0.1.2", "mediapipe==0.10.3", "mpmath==1.3.0", "multidict==6.0.4", "networkx==3.1", "numba==0.57.1", "numpy==1.23.5", "oauthlib==3.2.2", "omegaconf==2.2.3", "open-clip-torch==2.20.0", "opencv-contrib-python==4.8.0.76", "opencv-python==4.8.0.76", "orjson==3.9.5", "packaging==23.1", "pandas==2.0.3", "piexif==1.1.3", "pillow==9.5.0", "pip==23.2.1", "platformdirs==3.10.0", "portalocker==2.7.0", "protobuf==3.20.0", "psutil==5.9.5", "pyasn1-modules==0.3.0", "pyasn1==0.5.0", "pycparser==2.21", "pydantic==1.10.12", "pydub==0.25.1", "pygments==2.16.1", "pyparsing==3.0.9", "pysocks==1.7.1", "python-dateutil==2.8.2", "python-multipart==0.0.6", "pytorch-lightning==1.9.4", "pytz==2023.3", "pywavelets==1.4.1", "pywin32==306", "pyyaml==6.0.1", "realesrgan==0.3.0", "referencing==0.30.2", "regex==2023.8.8", "reportlab==4.0.4", "requests-oauthlib==1.3.1", "requests==2.31.0", "resize-right==0.0.2", "rpds-py==0.9.2", "rsa==4.9", "safetensors==0.3.1", "scikit-image==0.21.0", "scipy==1.11.2", "semantic-version==2.10.0", "send2trash==1.8.2", "sentencepiece==0.1.99", "setuptools==68.1.2", "six==1.16.0", "smmap==5.0.0", "sniffio==1.3.0", "sounddevice==0.4.6", "soupsieve==2.4.1", "starlette==0.26.1", "svglib==1.5.1", "sympy==1.12", "tabulate==0.9.0", "tb-nightly==2.15.0a20230819", "tensorboard-data-server==0.7.1", "termcolor==2.3.0", "tifffile==2023.8.12", "timm==0.9.2", "tinycss2==1.2.1", "tokenizers==0.13.3", "tomesd==0.1.3", "tomli==2.0.1", "toolz==0.12.0", "torch==2.0.1+cu118", "torchdiffeq==0.2.3", "torchmetrics==1.0.3", "torchsde==0.2.5", "torchvision==0.15.2+cu118", "tqdm==4.66.1", "trampoline==0.1.2", "transformers==4.30.2", "typing-extensions==4.7.1", "tzdata==2023.3", "uc-micro-py==1.0.2", "urllib3==1.26.16", "uvicorn==0.23.2", "wcwidth==0.2.6", "webencodings==0.5.1", "websockets==11.0.3", "werkzeug==2.3.7", "wheel==0.41.1", "xformers==0.0.20", "yacs==0.1.8", "yapf==0.40.1", "yarl==1.9.2", "zipp==3.16.2" ] }

What browsers do you use to access the UI ?

Google Chrome

Console logs

You are up to date with the most recent release.
Launching Web UI with arguments: --autolaunch --update-check --no-half-vae --xformers
Traceback (most recent call last):
  File "E:\AUTOMATIC1111\webui\launch.py", line 48, in <module>
    main()
  File "E:\AUTOMATIC1111\webui\launch.py", line 44, in main
    start()
  File "E:\AUTOMATIC1111\webui\modules\launch_utils.py", line 432, in start
    import webui
  File "E:\AUTOMATIC1111\webui\webui.py", line 13, in <module>
    initialize.imports()
  File "E:\AUTOMATIC1111\webui\modules\initialize.py", line 37, in imports
    from modules import processing, gradio_extensons, ui  # noqa: F401
  File "E:\AUTOMATIC1111\webui\modules\processing.py", line 31, in <module>
    from ldm.data.util import AddMiDaS
  File "E:\AUTOMATIC1111\webui\repositories\stable-diffusion-stability-ai\ldm\data\util.py", line 3, in <module>
    from ldm.modules.midas.api import load_midas_transform
  File "E:\AUTOMATIC1111\webui\repositories\stable-diffusion-stability-ai\ldm\modules\midas\api.py", line 11, in <module>
    from ldm.modules.midas.midas.transforms import Resize, NormalizeImage, PrepareForNet
  File "E:\AUTOMATIC1111\webui\repositories\stable-diffusion-stability-ai\ldm\modules\midas\midas\transforms.py", line 6, in <module>
    def apply_min_size(sample, size, image_interpolation_method=cv2.INTER_AREA):
AttributeError: module 'cv2' has no attribute 'INTER_AREA'
Premere un tasto per continuare . . .

Additional information

Error caught was: No module named 'triton' E:\AUTOMATIC1111\system\python\lib\site-packages\pytorch_lightning\utilities\distributed.py:258: LightningDeprecationWarning: pytorch_lightning.utilities.distributed.rank_zero_only has been deprecated in v1.8.1 and will be removed in v2.0.0. You can import it from pytorch_lightning.utilities instead. rank_zero_deprecation(

w-e-w commented 10 months ago

I'm not sure how that happened 'm guessing that some strange issue happened during install

I would try deleting the venv and launch (which would also recreate the venv) again

to be extra safe you might want to run

`python -m pip cache purge`

https://pip.pypa.io/en/stable/cli/pip_cache/ maybe something strange happened in your pip cache

Lowkeyyyyyyy commented 9 months ago

I have the same or similar issue https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/14038

Tried steps above to no avali

Lowkeyyyyyyy commented 9 months ago

My issue was solved by running SD using: \sd.webui\webui\webui-user.bat Instead of \sd.webui\Run.bat

tetshuna commented 9 months ago

I solved by deleting the "system" folder, then re-downloaded the repo, copied the "system" folder from the rar file and started "environment.bat".

Thank you all for the answers!

w-e-w commented 9 months ago

My issue was solved by running SD using: \sd.webui\webui\webui-user.bat Instead of \sd.webui\Run.bat

I solved by deleting the "system" folder, then re-downloaded the repo, copied the "system" folder from the rar file and started "environment.bat".

Thank you all for the answers!

both your solutions are basically equivalent to "deleting the venv"

wdj20xp commented 8 months ago

python -m pip uninstall opencv-python python -m pip uninstall opencv-contrib-python python -m pip install opencv-python python -m pip install opencv-contrib-python

Just reinstall these two components