AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: Networkx version error on Ubuntu 20.04 #16256

Open Ken-g6 opened 4 months ago

Ken-g6 commented 4 months ago

Checklist

What happened?

On executing a freshly downloaded copy of webui.sh, it tries to grab networkx-3.2.1 which is not compatible with Python 3.8.

Steps to reproduce the problem

  1. sudo apt install wget git python3 python3-venv
  2. wget -qO- https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh > sd-webui.sh
  3. bash sd-webui.sh

What should have happened?

WebUI should have been installed.

What browsers do you use to access the UI ?

Mozilla Firefox

Sysinfo

That didn't work either:

$ bash sd-webui.sh --dump-sysinfo

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer.
################################################################

################################################################
Running on ken user
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
glibc version is 2.31
Cannot locate TCMalloc. Do you have tcmalloc or google-perftool installed on your system? (improves CPU memory usage)
Traceback (most recent call last):
  File "launch.py", line 48, in <module>
    main()
  File "launch.py", line 29, in main
    filename = launch_utils.dump_sysinfo()
  File "/userfiles/ken/ai/stable-diffusion-webui/modules/launch_utils.py", line 473, in dump_sysinfo
    from modules import sysinfo
  File "/userfiles/ken/ai/stable-diffusion-webui/modules/sysinfo.py", line 8, in <module>
    import psutil
ModuleNotFoundError: No module named 'psutil'

Console logs

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer.
################################################################

################################################################
Running on ken user
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
glibc version is 2.31
Cannot locate TCMalloc. Do you have tcmalloc or google-perftool installed on your system? (improves CPU memory usage)
Python 3.8.10 (default, Mar 25 2024, 10:42:49) 
[GCC 9.4.0]
Version: v1.9.4
Commit hash: feee37d75f1b168768014e4634dcb156ee649c05
Installing torch and torchvision
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu121
Collecting torch==2.1.2
  Using cached https://download.pytorch.org/whl/cu121/torch-2.1.2%2Bcu121-cp38-cp38-linux_x86_64.whl (2200.7 MB)
Collecting torchvision==0.16.2
  Using cached https://download.pytorch.org/whl/cu121/torchvision-0.16.2%2Bcu121-cp38-cp38-linux_x86_64.whl (6.9 MB)
Collecting networkx
  Using cached https://download.pytorch.org/whl/networkx-3.2.1-py3-none-any.whl (1.6 MB)
ERROR: Package 'networkx' requires a different Python: 3.8.10 not in '>=3.9'
Traceback (most recent call last):
  File "launch.py", line 48, in <module>
    main()
  File "launch.py", line 39, in main
    prepare_environment()
  File "/userfiles/ken/ai/stable-diffusion-webui/modules/launch_utils.py", line 380, in prepare_environment
    run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
  File "/userfiles/ken/ai/stable-diffusion-webui/modules/launch_utils.py", line 115, in run
    raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install torch.
Command: "/userfiles/ken/ai/stable-diffusion-webui/venv/bin/python3" -m pip install torch==2.1.2 torchvision==0.16.2 --extra-index-url https://download.pytorch.org/whl/cu121
Error code: 1


### Additional information

See also https://github.com/mlcommons/inference/issues/1697 which seems to reference the same bug.

I was able to install `pip3 install torch torchvision torchaudio` but I can't see how to translate that to your config files for python3-venv.
viking1304 commented 4 months ago

Update:

Add deadsnakes/ppa

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update

Install python 3.10

sudo apt install python3.10 python3.10-venv

Open webui-user.sh and find this

# python3 executable
#python_cmd="python3"

Replace with

# python3 executable
python_cmd="python3.10"

Remove venv folder from /userfiles/ken/ai/stable-diffusion-webui

Run ./webui.sh

After the release of a new version of A1111, there will be no need to change python version in webui-user.sh anymore https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/16092

Ken-g6 commented 4 months ago

@viking1304 Couldn't find any package by glob 'python3.10'. I can't find anything resembling that version in Synaptic either.

viking1304 commented 4 months ago

@viking1304 Couldn't find any package by glob 'python3.10'. I can't find anything resembling that version in Synaptic either.

I am sorry, I misread your system version. I though it is Ubuntu 22.

For 20 and 24 you need to add deadsnakes/ppa first.

I updated my previous answer.