AUTOMATIC1111 / stable-diffusion-webui

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

Broken Installation and Execution on Nobara Linux #15384

Closed OttCS closed 3 months ago

OttCS commented 5 months ago

Checklist

What happened?

The provided installation instructions for Linux don't seem to be working, at least for Nobara (which is Fedora based). The error printout is below, but of note:

  1. sudo dnf install python3 currently installs version 3.12.2 which doesn't support torch.
  2. Even with python 3.10 installed (sudo dnf install python3.10), the ./webui.sh launch doesn't detect this.
  3. The specific guide 'For Installing Python 3.10' under the linux Nvidia setup requires pacman (which is broken when installed and running sudo pacman -S pyenv or sudo pacman -Sy pyenv)

Something may be configured wrong on Nobara's part, but I'm willing to help with making the guides for webui on Linux more reliable.

Steps to reproduce the problem

  1. Clean install of Nobara Linux (nvidia edition if NV GPU is present): https://nobaraproject.org/download-nobara/
  2. Follow Linux Nvidia Install instructions: https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-NVidia-GPUs#linux
  3. Problem appears

What should have happened?

WebUI should be able to run on Nobara (and actually used to before some time in the past month)

What browsers do you use to access the UI ?

Other

Sysinfo

dump-sysinfo.txt

Console logs

$ sudo dnf install git python3 -y && git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui && cd stable-diffusion-webui && ./webui.sh
[sudo] password for user: 
nobara-appstream-39                                                                                                                                                                                                                                                                         2.8 kB/s | 1.5 kB     00:00    
nobara-appstream-39                                                                                                                                                                                                                                                                         455 kB/s | 386 kB     00:00    
nobara-kde6                                                                                                                                                                                                                                                                                 2.5 kB/s | 1.5 kB     00:00    
nobara-kde6-overrides                                                                                                                                                                                                                                                                       2.0 kB/s | 1.5 kB     00:00    
nobara-kde6-overrides                                                                                                                                                                                                                                                                       323 kB/s | 214 kB     00:00    
nobara-baseos-39                                                                                                                                                                                                                                                                            952  B/s | 1.5 kB     00:01    
nobara-baseos-39                                                                                                                                                                                                                                                                            3.0 MB/s | 4.6 MB     00:01    
nobara-baseos-multilib-39                                                                                                                                                                                                                                                                   1.9 kB/s | 1.5 kB     00:00    
nobara-baseos-multilib-39                                                                                                                                                                                                                                                                   943 kB/s | 743 kB     00:00    
nobara-rocm-official                                                                                                                                                                                                                                                                        527 kB/s | 217 kB     00:00    
cloudflare-warp-stable                                                                                                                                                                                                                                                                       16 kB/s | 3.0 kB     00:00    
Fedora 39 - x86_64 - Updates                                                                                                                                                                                                                                                                4.4 kB/s | 2.0 kB     00:00    
RPM Fusion for Fedora 39 - Free - Updates                                                                                                                                                                                                                                                   5.1 kB/s | 3.0 kB     00:00    
RPM Fusion for Fedora 39 - Free - Updates                                                                                                                                                                                                                                                   338 kB/s | 241 kB     00:00    
RPM Fusion for Fedora 39 - Nonfree - Updates                                                                                                                                                                                                                                                 44 kB/s | 6.0 kB     00:00    
RPM Fusion for Fedora 39 - Nonfree - Updates                                                                                                                                                                                                                                                157 kB/s |  86 kB     00:00    
Package git-2.44.0-1.fc39.x86_64 is already installed.
Package python3-3.12.2-2.fc39.x86_64 is already installed.
Package python3-3.12.2-2.fc39.i686 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
Cloning into 'stable-diffusion-webui'...
remote: Enumerating objects: 32668, done.
remote: Counting objects: 100% (78/78), done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 32668 (delta 28), reused 61 (delta 22), pack-reused 32590
Receiving objects: 100% (32668/32668), 34.42 MiB | 7.87 MiB/s, done.
Resolving deltas: 100% (22855/22855), done.

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

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

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Experimental support for Renoir: make sure to have at least 4GB of VRAM and 10GB of RAM or enable cpu mode: --use-cpu all --no-half
################################################################

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

################################################################
Launching launch.py...
################################################################
glibc version is 2.38
Check TCMalloc: libtcmalloc_minimal.so.4
libtcmalloc_minimal.so.4 is linked with libc.so,execute LD_PRELOAD=/lib64/libtcmalloc_minimal.so.4
=============================================================================================
INCOMPATIBLE PYTHON VERSION

This program is tested with 3.10.6 Python, but you have 3.12.2.
If you encounter an error with "RuntimeError: Couldn't install torch." message,
or any other error regarding unsuccessful package (library) installation,
please downgrade (or upgrade) to the latest version of 3.10 Python
and delete current Python and "venv" folder in WebUI's directory.

You can download 3.10 Python from here: https://www.python.org/downloads/release/python-3106/

Use --skip-python-version-check to suppress this warning.
=============================================================================================
Python 3.12.2 (main, Feb 21 2024, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)]
Version: v1.8.0
Commit hash: bef51aed032c0aaa5cfd80445bc4cf0d85b408b5
Installing torch and torchvision
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu121
ERROR: Could not find a version that satisfies the requirement torch==2.1.2 (from versions: 2.2.0, 2.2.0+cu121, 2.2.1, 2.2.1+cu121)
ERROR: No matching distribution found for torch==2.1.2

[notice] A new release of pip is available: 23.2.1 -> 24.0
[notice] To update, run: pip install --upgrade pip
Traceback (most recent call last):
  File "/run/media/user/nvme1n1p1/stable-diffusion-webui/launch.py", line 48, in <module>
    main()
  File "/run/media/user/nvme1n1p1/stable-diffusion-webui/launch.py", line 39, in main
    prepare_environment()
  File "/run/media/user/nvme1n1p1/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 "/run/media/user/nvme1n1p1/stable-diffusion-webui/modules/launch_utils.py", line 115, in run
    raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install torch.
Command: "/run/media/user/nvme1n1p1/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

Browser selection is should not matter, as WebUI is failing before opening.

Mershl commented 5 months ago

tested on Fedora 40:

cd stable-diffusion-webui

// remove previous attemps of installation
rm -rf venv

// edit webui-user.sh
// uncomment python_cmd
python_cmd="python3.10"
// uncomment TORCH_COMMAND
export TORCH_COMMAND="pip install torch torchvision --index-url https://download.pytorch.org/whl/nightly/rocm6.0"

sudo dnf install python3.10 gperftools-libs libglvnd-glx rocm-opencl

./webui.sh

Fedora 40 ships rocm6 while stable-diffusion-webui "officially" supports rocm 5.6 and 5.7. Prepare for a rough flight (applies in general with AMDGPU in compute space).

EDIT: don't bother with rocm 6.0 will crash every other generation. Using a container with Fedora 38 (which ships with rocm 5.5) is more stable in my experience.

OttCS commented 5 months ago

After disabling AMD Integrated GPU, I only did:

And it auto-fetched a working version of torch, no TORCH_COMMAND change necessary.

While this seems to fix the issue for Nobara (39), shouldn't the setup include changing the commented python version if it detects a bad one also installed?

EmersonBiggons commented 5 months ago

I am having this exact issue, it seems we have a version of Python, Pytorch and CUDA that is too new and isnt properly recognized by WebUI. I am running a fully up to date Nobara (39) release and mirror the initial Nvidia related issue.

Mershl commented 5 months ago

I am having this exact issue, it seems we have a version of Python, Pytorch and CUDA that is too new and isnt properly recognized by WebUI. I am running a fully up to date Nobara (39) release and mirror the initial Nvidia related issue.

Fedora includes the last 4 Python releases. While the latest is named just python the previous include their version in their name python3.9, python3.10 and so on.

Try:

sudo dnf install python3.10

// edit webui-user.sh of stable-diffusion-webui
// uncomment python_cmd
python_cmd="python3.10"

(delete the .venv inside stable-diffusion-webui if your previous installation failed to avoid corrupted environments)

EmersonBiggons commented 5 months ago

I am having this exact issue, it seems we have a version of Python, Pytorch and CUDA that is too new and isnt properly recognized by WebUI. I am running a fully up to date Nobara (39) release and mirror the initial Nvidia related issue.

Fedora includes the last 4 Python releases. While the latest is named just python the previous include their version in their name python3.9, python3.10 and so on.

Try:

sudo dnf install python3.10

// edit webui-user.sh of stable-diffusion-webui
// uncomment python_cmd
python_cmd="python3.10"

(delete the .venv inside stable-diffusion-webui if your previous installation failed to avoid corrupted environments)

Did as instructed, and it installed! I will come back incase it finds a reason to not function

Edit: Appears to work, generates images and everything!

OttCS commented 3 months ago

Judging by how reliable these fixes are, I made a small (unofficial) guide for how to install this on Linux, hopefully someone can tell me how to contribute to this wiki so the information is easier to find.

https://github.com/OttCS/OttCS/blob/main/blog/2024/5/linux-automatic1111-sd.md

OttCS commented 3 months ago

Closing the issue, as the linux install instructions have been updated