AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: Can't install torch/torchvision, can't find correct version #8794

Open Karsten385 opened 1 year ago

Karsten385 commented 1 year ago

Is there an existing issue for this?

What happened?

Can't install torch/torchvision when running webui-user.bat

Steps to reproduce the problem

Run webui-user.bat

What should have happened?

Program should have installed torch/torchvision

Commit where the problem happens

Commit hash: a9fed7c364061ae6efb37f797b6b522cb3cf7aa2

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

No

List of extensions

No

Console logs

venv "C:\Users\Karsten\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:38:17) [MSC v.1932 32 bit (Intel)]
Commit hash: a9fed7c364061ae6efb37f797b6b522cb3cf7aa2
Installing torch and torchvision
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu117
ERROR: Could not find a version that satisfies the requirement torch==1.13.1+cu117 (from versions: none)
ERROR: No matching distribution found for torch==1.13.1+cu117

[notice] A new release of pip available: 22.2.1 -> 23.0.1
[notice] To update, run: C:\Users\Karsten\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip
Traceback (most recent call last):
  File "C:\Users\Karsten\stable-diffusion-webui\launch.py", line 380, in <module>
    prepare_environment()
  File "C:\Users\Karsten\stable-diffusion-webui\launch.py", line 284, in prepare_environment
    run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
  File "C:\Users\Karsten\stable-diffusion-webui\launch.py", line 97, in run
    raise RuntimeError(f"""{errdesc or 'Error running command'}.
RuntimeError: Couldn't install torch.
Command: "C:\Users\Karsten\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117
Error code: 1
Press any key to continue . . .

Additional information

Running windows 10, Nvidia 1050ti graphics card if that is necessary.

Lil-Strudel commented 1 year ago

Seems to be the same as #6592

Their solution of deleting the 'venv' folder, worked for me!

Best of luck.

lynxife commented 1 year ago

I solved it by remove and reinstall python and pip, and also remove the 'venv' folder.

duval1024 commented 1 year ago

same problem on centos8 i had tried reinstall python(3.10.6) and pip, and remove the 'venv' folder,but it not work

Could not fetch URL https://download.pytorch.org/whl/cu117/torch/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='download.pytorch.org', port=443): Max retries exceeded with url: /whl/cu117/torch/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement torch==1.13.1+cu117 (from versions: none)
ERROR: No matching distribution found for torch==1.13.1+cu117
duval1024 commented 1 year ago

/> same problem on centos8 i had tried reinstall python(3.10.6) and pip, and remove the 'venv' folder,but it not work

Could not fetch URL https://download.pytorch.org/whl/cu117/torch/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='download.pytorch.org', port=443): Max retries exceeded with url: /whl/cu117/torch/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement torch==1.13.1+cu117 (from versions: none)
ERROR: No matching distribution found for torch==1.13.1+cu117

i fix this problem by reinstall openssl, and reinstall python 3.10.6 with new openssl. all steps are as follow :

1. download openssl

wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz tar -zxvf openssl-1.1.1a.tar.gz cd openssl-1.1.1a

2.compile && install openssl

./config --prefix=/usr/local/openssl no-zlib make make install

3.backup the old openssl

mv /usr/bin/openssl /usr/bin/openssl.bak mv /usr/include/openssl/ /usr/include/openssl.bak

4.ln the new openssl

ln -s /usr/local/openssl/include/openssl /usr/include/openssl ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/local/lib64/libssl.so ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl

5.change the search path for openssl

echo "/usr/local/openssl/lib" >> /etc/ld.so.conf ldconfig -v

6.ensure the right version

openssl version

7. (optional)install depencencies

yum groupinstall -y "Development tools" yum install -y ncurses-devel gdbm-devel xz-devel sqlite-devel tk-devel uuid-devel readline-devel bzip2-devel libffi-devel xz-devel mesa-libGL python-backports-lzma

8.reinstall python 3.10.6

./configure --with-openssl=/usr/local/openssl && make && make install ln -s /usr/local/bin/pip3 /usr/bin/pip3 ln -s /usr/local/bin/python3 /usr/bin/python3