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

[Bug]: RuntimeError: Detected that PyTorch and torchvision were compiled with different CUDA versions.

Open Dougierulez opened this issue 2 years ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

Latest update as of today at least on my system, seems to have became broken due to a cuda version mismatch between torchvision and pytorch.

Steps to reproduce the problem

Currently just starting up the normal webui-user.bat with the normal git-update command and alll that and currently unable to fully start up due to cuda version mismatch between pytorch and torchvision now

What should have happened?

Just a normal startup as usual

Commit where the problem happens

7ba3923

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

No response

Command Line Arguments

hint: core.useBuiltinFSMonitor=true is deprecated;please set core.fsmonitor=true instead
hint: Disable this message with "git config advice.useCoreFSMonitorConfig false"
Already up to date.
venv "C:\ai\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: 7ba3923d5b494b7756d0b12f33acb3716d830b9a
Installing requirements for Web UI
Launching Web UI with arguments: --deepdanbooru
Traceback (most recent call last):
  File "C:\ai\stable-diffusion-webui\launch.py", line 252, in <module>
    start()
  File "C:\ai\stable-diffusion-webui\launch.py", line 243, in start
    import webui
  File "C:\ai\stable-diffusion-webui\webui.py", line 13, in <module>
    from modules import devices, sd_samplers, upscaler, extensions, localization
  File "C:\ai\stable-diffusion-webui\modules\sd_samplers.py", line 8, in <module>
    import k_diffusion.sampling
  File "C:\ai\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\__init__.py", line 1, in <module>
    from . import augmentation, config, evaluation, external, gns, layers, models, sampling, utils
  File "C:\ai\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\config.py", line 8, in <module>
    from . import augmentation, layers, models, utils
  File "C:\ai\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\layers.py", line 8, in <module>
    from . import utils
  File "C:\ai\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\utils.py", line 13, in <module>
    from torchvision.transforms import functional as TF
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\torchvision\__init__.py", line 5, in <module>
    from torchvision import datasets
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\torchvision\datasets\__init__.py", line 1, in <module>
    from ._optical_flow import KittiFlow, Sintel, FlyingChairs, FlyingThings3D, HD1K
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\torchvision\datasets\_optical_flow.py", line 12, in <module>
    from ..io.image import _read_png_16
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\torchvision\io\__init__.py", line 8, in <module>
    from ._load_gpu_decoder import _HAS_GPU_VIDEO_DECODER
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\torchvision\io\_load_gpu_decoder.py", line 1, in <module>
    from ..extension import _load_library
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\torchvision\extension.py", line 93, in <module>
    _check_cuda_version()
  File "C:\ai\stable-diffusion-webui\venv\lib\site-packages\torchvision\extension.py", line 66, in _check_cuda_version
    raise RuntimeError(
RuntimeError: Detected that PyTorch and torchvision were compiled with different CUDA versions. PyTorch has CUDA Version=11.6 and torchvision has CUDA Version=11.3. Please reinstall the torchvision that matches your PyTorch install.
Press any key to continue . . .

Additional information, context and logs

No response

Dougierulez avatar Nov 12 '22 06:11 Dougierulez

I'm having the same issue. Tried to update torchvision to 11.6 with pip, but still not working.

skdursh avatar Nov 12 '22 17:11 skdursh

Quick follow-up: I just figured out how to fix it. Go into the "venv" folder in your main directory, go to "Lib\site-packages", scroll down to the two folders that start with "torchvision" and delete them. Them run the webui-user.bat file like normal to start up and it will redownload the appropriate packages you need. Then just launch as normal.

I believe the issue has something to do with one of the extensions, though I'm not sure which one yet.

skdursh avatar Nov 12 '22 18:11 skdursh

Just got this same issue when activating the Dreambooth extension, it errored out on webui-user.bat relaunch, and upon a second attempt it redownloaded torch automatically, negating my lovelace cuda fix.

B34STW4RS avatar Nov 13 '22 10:11 B34STW4RS

I got it after installing the dreambooth extension...

fastsyrup avatar Nov 14 '22 18:11 fastsyrup

Quick follow-up: I just figured out how to fix it. Go into the "venv" folder in your main directory, go to "Lib\site-packages", scroll down to the two folders that start with "torchvision" and delete them. Them run the webui-user.bat file like normal to start up and it will redownload the appropriate packages you need. Then just launch as normal.

I believe the issue has something to do with one of the extensions, though I'm not sure which one yet.

Tried this, and I'm still getting the same error after reinstalling torch

seanawesome avatar Nov 15 '22 23:11 seanawesome

Quick follow-up: I just figured out how to fix it. Go into the "venv" folder in your main directory, go to "Lib\site-packages", scroll down to the two folders that start with "torchvision" and delete them. Them run the webui-user.bat file like normal to start up and it will redownload the appropriate packages you need. Then just launch as normal. I believe the issue has something to do with one of the extensions, though I'm not sure which one yet.

Tried this, and I'm still getting the same error after reinstalling torch

Do you have extensions installed? If you do you'll need to delete them or temporarily move them to a folder outside of your stable-diffusion-webui directory first and then delete the torchvision folders and launch webui-user.bat to redownload the compatible versions. This error seems to usually caused by an issue with one of the extensions, though I'm not sure exactly which one. The only one I am running right now is Deforum, which is working fine.

Also, have you had WebUI previously working or is this your first install? If it's first install your problem might be due to an incompatible Python version. Right now you need Python 3.10.x to guarantee functionality. 3.11 will fail due to a Pytorch incompatibility, 3.7 causes issues with Codeformer and I think 3.8 does as well.

skdursh avatar Nov 17 '22 04:11 skdursh

Also having this issue when attempting to install the Dreambooth extension.

H00plyha avatar Nov 19 '22 09:11 H00plyha

I got it after installing the dreambooth extension... Yep, the same here

gleblebedev avatar Nov 19 '22 17:11 gleblebedev

Do you have extensions installed? If you do you'll need to delete them or temporarily move them to a folder outside of your stable-diffusion-webui directory first and then delete the torchvision folders and launch webui-user.bat to redownload the compatible versions.

This worked for me to have Automatic1111 start again, thanks - yet it fails again if I restore the dreambooth extension

cristoforo avatar Nov 20 '22 13:11 cristoforo

Quick follow-up: I just figured out how to fix it. Go into the "venv" folder in your main directory, go to "Lib\site-packages", scroll down to the two folders that start with "torchvision" and delete them. Them run the webui-user.bat file like normal to start up and it will redownload the appropriate packages you need. Then just launch as normal.

I believe the issue has something to do with one of the extensions, though I'm not sure which one yet.

I had tried editing the requirements.txt and a few other things. Cost me a couple of days. Then tried your solution and I am back up and running. Many thanks, (bows low).

stokemctoke avatar May 25 '23 15:05 stokemctoke