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

[Bug]: RuntimeError: Couldn't install torch. | stderr: ERROR: Exception:

Open FijiZay opened this issue 1 year ago • 12 comments

Is there an existing issue for this?

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

What happened?

Every time i am trying to install webui i got error. I updated gpu drivers, re-installed python and its still not working and i got same error and i don't know what to do anymore.

Steps to reproduce the problem

Creating venv in directory venv using python "C:\Users\HP\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe" venv "G:\stable-diffusion-webui\venv\Scripts\Python.exe" Python 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)] Commit hash: b08698a09a257365238e43cc9023ce7cf9af73c4 Installing torch and torchvision Traceback (most recent call last): File "G:\stable-diffusion-webui\launch.py", line 251, in prepare_enviroment() File "G:\stable-diffusion-webui\launch.py", line 169, in prepare_enviroment run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch") File "G:\stable-diffusion-webui\launch.py", line 34, in run raise RuntimeError(message) RuntimeError: Couldn't install torch. Command: "G:\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113 Error code: 2 stdout: Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu113 Collecting torch==1.12.1+cu113 Using cached https://download.pytorch.org/whl/cu113/torch-1.12.1%2Bcu113-cp310-cp310-win_amd64.whl (2143.8 MB) Collecting torchvision==0.13.1+cu113 Using cached https://download.pytorch.org/whl/cu113/torchvision-0.13.1%2Bcu113-cp310-cp310-win_amd64.whl (4.7 MB) Collecting typing-extensions Using cached typing_extensions-4.4.0-py3-none-any.whl (26 kB) Collecting numpy Using cached numpy-1.23.4-cp310-cp310-win_amd64.whl (14.6 MB) Collecting requests Using cached requests-2.28.1-py3-none-any.whl (62 kB) Collecting pillow!=8.3.*,>=5.3.0 Using cached Pillow-9.3.0-cp310-cp310-win_amd64.whl (2.5 MB) Collecting urllib3<1.27,>=1.21.1 Using cached urllib3-1.26.12-py2.py3-none-any.whl (140 kB) Collecting idna<4,>=2.5 Using cached idna-3.4-py3-none-any.whl (61 kB) Collecting charset-normalizer<3,>=2 Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB) Collecting certifi>=2017.4.17 Using cached certifi-2022.9.24-py3-none-any.whl (161 kB) Installing collected packages: urllib3, typing-extensions, pillow, numpy, idna, charset-normalizer, certifi, torch, requests, torchvision

stderr: ERROR: Exception: Traceback (most recent call last): File "G:\stable-diffusion-webui\venv\lib\site-packages\pip_internal\cli\base_command.py", line 167, in exc_logging_wrapper status = run_func(*args) File "G:\stable-diffusion-webui\venv\lib\site-packages\pip_internal\cli\req_command.py", line 247, in wrapper return func(self, options, args) File "G:\stable-diffusion-webui\venv\lib\site-packages\pip_internal\commands\install.py", line 461, in run installed = install_given_reqs( File "G:\stable-diffusion-webui\venv\lib\site-packages\pip_internal\req_init_.py", line 73, in install_given_reqs requirement.install( File "G:\stable-diffusion-webui\venv\lib\site-packages\pip_internal\req\req_install.py", line 790, in install install_wheel( File "G:\stable-diffusion-webui\venv\lib\site-packages\pip_internal\operations\install\wheel.py", line 727, in install_wheel _install_wheel( File "G:\stable-diffusion-webui\venv\lib\site-packages\pip_internal\operations\install\wheel.py", line 587, in _install_wheel file.save() File "G:\stable-diffusion-webui\venv\lib\site-packages\pip_internal\operations\install\wheel.py", line 388, in save shutil.copyfileobj(f, dest) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\shutil.py", line 195, in copyfileobj buf = fsrc_read(length) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\zipfile.py", line 925, in read data = self._read1(n) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\zipfile.py", line 1015, in _read1 self._update_crc(data) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\zipfile.py", line 943, in _update_crc raise BadZipFile("Bad CRC-32 for file %r" % self.name) zipfile.BadZipFile: Bad CRC-32 for file 'torch/lib/cusolverMg64_11.dll'

[notice] A new release of pip available: 22.2.2 -> 22.3.1 [notice] To update, run: G:\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip

Press any key to continue . . .

What should have happened?

install it obviously.

Commit where the problem happens

when installing

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

No response

Command Line Arguments

No response

Additional information, context and logs

No response

FijiZay avatar Nov 07 '22 03:11 FijiZay

Try this command

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

neoOpus avatar Nov 07 '22 06:11 neoOpus

Same error as before

FijiZay avatar Nov 07 '22 12:11 FijiZay

I have this same issue, it appears to be something caused by one of the most recent updates. I had no problem with installation prior to 4 days ago.

@FijiZay Did you ever figure out a solution?

AntiCensor avatar Nov 10 '22 07:11 AntiCensor

I have this same issue, it appears to be something caused by one of the most recent updates. I had no problem with installation prior to 4 days ago.

@FijiZay Did you ever figure out a solution?

Sadly no and i don't know what's causing it.

FijiZay avatar Nov 10 '22 12:11 FijiZay

Same here

sebaschapela avatar Nov 17 '22 01:11 sebaschapela

so I hope this will help and it fixed it for me, I had to go back to python 3.10.7 for torch to install. A search on stack overflow regarding torch mentioned it was behind the latest releases of python

drknite72 avatar Nov 18 '22 02:11 drknite72

image nothing works

FijiZay avatar Nov 22 '22 00:11 FijiZay

3.10.7 same results as 3.10.6 i really wanted to do something but this trash cant even work and there is noone who can help me

FijiZay avatar Nov 22 '22 00:11 FijiZay

@AUTOMATIC1111 i tried everything and i am loosing it

FijiZay avatar Nov 22 '22 00:11 FijiZay

guys try using Docker ported version https://github.com/AbdBarho/stable-diffusion-webui-docker

neoOpus avatar Nov 22 '22 23:11 neoOpus

Solution is to use Python 3.10.6 64-bit install as listed in dependencies.

Other versions will not work.

levicki avatar Dec 17 '22 16:12 levicki

had the same issue i managed to fix it by uninstalling every pyhton installation and manually deleting it's directories,restarting the computer and installing python through the .exe specified in here ,also choose custom installation and check add to path option ,that seemed to have solved it

viper-dark avatar Feb 18 '23 23:02 viper-dark

Closing as stale.

catboxanon avatar Aug 03 '23 18:08 catboxanon