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

[Bug]: Installation doesn't complete, causes errors with pip/setuptools/torch - Arch linux

Open DanielMazurkiewicz opened this issue 1 year ago • 7 comments

Checklist

  • [ ] The issue exists after disabling all extensions
  • [X] The issue exists on a clean installation of webui
  • [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • [X] The issue exists in the current version of the webui
  • [X] The issue has not been reported before recently
  • [ ] The issue has been reported before but has not been fixed yet

What happened?

Installation breaks, details in console logs section

Steps to reproduce the problem

Get latest Arch linux on Ryzen APU (eg 8700G) Follow instructions for Arch from readme Try to install it

What should have happened?

Installation should complete

What browsers do you use to access the UI ?

Other

Sysinfo

Not there yet, breaks on installation

Console logs

$ sh webui.sh 

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

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

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

################################################################
Launching launch.py...
################################################################
Using TCMalloc: libtcmalloc_minimal.so.4
Python 3.11.6 (main, Nov 14 2023, 09:36:21) [GCC 13.2.1 20230801]
Version: v1.7.0
Commit hash: cf2772fab0af5573da775e7437e6acdca424f26e
Installing torch and torchvision
Looking in indexes: https://download.pytorch.org/whl/rocm5.4.2
Collecting torch==2.0.1+rocm5.4.2
  Using cached https://download.pytorch.org/whl/rocm5.4.2/torch-2.0.1%2Brocm5.4.2-cp311-cp311-linux_x86_64.whl (1536.4 MB)
Collecting torchvision==0.15.2+rocm5.4.2
  Using cached https://download.pytorch.org/whl/rocm5.4.2/torchvision-0.15.2%2Brocm5.4.2-cp311-cp311-linux_x86_64.whl (62.4 MB)
Collecting filelock (from torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/filelock-3.9.0-py3-none-any.whl (9.7 kB)
Collecting typing-extensions (from torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/typing_extensions-4.8.0-py3-none-any.whl (31 kB)
Collecting sympy (from torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/sympy-1.12-py3-none-any.whl (5.7 MB)
Collecting networkx (from torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/networkx-3.2.1-py3-none-any.whl (1.6 MB)
Collecting jinja2 (from torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting pytorch-triton-rocm<2.1,>=2.0.0 (from torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/pytorch_triton_rocm-2.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (78.4 MB)
Collecting numpy (from torchvision==0.15.2+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/numpy-1.26.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB)
Collecting requests (from torchvision==0.15.2+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/requests-2.28.1-py3-none-any.whl (62 kB)
Collecting pillow!=8.3.*,>=5.3.0 (from torchvision==0.15.2+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/pillow-10.2.0-cp311-cp311-manylinux_2_28_x86_64.whl (4.5 MB)
Collecting cmake (from pytorch-triton-rocm<2.1,>=2.0.0->torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/cmake-3.25.0-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.7 MB)
Collecting lit (from pytorch-triton-rocm<2.1,>=2.0.0->torch==2.0.1+rocm5.4.2)
  Using cached https://download.pytorch.org/whl/lit-15.0.7.tar.gz (132 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      Looking in indexes: https://download.pytorch.org/whl/rocm5.4.2
      ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
      ERROR: No matching distribution found for setuptools>=40.8.0
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Traceback (most recent call last):
  File "/home/daniel/soft/stable_diffusion_webui/stable-diffusion-webui/launch.py", line 48, in <module>
    main()
  File "/home/daniel/soft/stable_diffusion_webui/stable-diffusion-webui/launch.py", line 39, in main
    prepare_environment()
  File "/home/daniel/soft/stable_diffusion_webui/stable-diffusion-webui/modules/launch_utils.py", line 378, in prepare_environment
    run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
  File "/home/daniel/soft/stable_diffusion_webui/stable-diffusion-webui/modules/launch_utils.py", line 116, in run
    raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install torch.
Command: "/home/daniel/soft/stable_diffusion_webui/stable-diffusion-webui/venv/bin/python3" -m pip install torch==2.0.1+rocm5.4.2 torchvision==0.15.2+rocm5.4.2 --index-url https://download.pytorch.org/whl/rocm5.4.2
Error code: 1

Additional information

No response

DanielMazurkiewicz avatar Feb 08 '24 11:02 DanielMazurkiewicz

Same with me.

dreirund avatar Feb 08 '24 14:02 dreirund

Same for Windows 11 with webui-user.bat

ERROR: Could not find a version that satisfies the requirement torch==2.0.1 (from versions: 2.2.0, 2.2.0+cu118)
ERROR: No matching distribution found for torch==2.0.1

updating modules\launch_utils.py line 318 to the latest lib versions:

torch_command = os.environ.get('TORCH_COMMAND', f"pip install torch==2.2.0 torchvision==0.17.0 --extra-index-url {torch_index_url}")

fixes the problem,

but then the install still fails for me at some point, because sentencepiece does not support python 3.12 yet (it would probably work if I downgraded to 3.10 as suggested by the installer, but I will just wait for the new version of sentencepiece to bereleased)

sedthh avatar Feb 10 '24 17:02 sedthh

Noticed that result for ryzen 8700g :

$ lspci | grep -E "VGA|Display"
0d:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Phoenix1 (rev 06)

doesn't match with anything here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/cf2772fab0af5573da775e7437e6acdca424f26e/webui.sh#L127

So forced it in script to go for Navi 3 and it did install, but is failing to start

# Check prerequisites
gpu_info=$(lspci 2>/dev/null | grep -E "VGA|Display")
case "$gpu_info" in
    *"Navi 1"*)
        export HSA_OVERRIDE_GFX_VERSION=10.3.0
        if [[ -z "${TORCH_COMMAND}" ]]
        then
            pyv="$(${python_cmd} -c 'import sys; print(".".join(map(str, sys.version_info[0:2])))')"
            if [[ $(bc <<< "$pyv <= 3.10") -eq 1 ]] 
            then
                # Navi users will still use torch 1.13 because 2.0 does not seem to work.
                export TORCH_COMMAND="pip install torch==1.13.1+rocm5.2 torchvision==0.14.1+rocm5.2 --index-url https://download.pytorch.org/whl/rocm5.2"
            else
                printf "\e[1m\e[31mERROR: RX 5000 series GPUs must be using at max python 3.10, aborting...\e[0m"
                exit 1
            fi
        fi
    ;;
    *"Navi 2"*) export HSA_OVERRIDE_GFX_VERSION=10.3.0
    ;;
    *"Phoenix1"*) [[ -z "${TORCH_COMMAND}" ]] && \
         export TORCH_COMMAND="pip install torch torchvision --index-url https://download.pytorch.org/whl/test/rocm5.6"
        # Navi 3 needs at least 5.5 which is only on the torch 2.1.0 release candidates right now
    ;;
    *"Navi 3"*) [[ -z "${TORCH_COMMAND}" ]] && \
         export TORCH_COMMAND="pip install torch torchvision --index-url https://download.pytorch.org/whl/test/rocm5.6"
        # Navi 3 needs at least 5.5 which is only on the torch 2.1.0 release candidates right now
    ;;
    *"Renoir"*) export HSA_OVERRIDE_GFX_VERSION=9.0.0
        printf "\n%s\n" "${delimiter}"
        printf "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"
        printf "\n%s\n" "${delimiter}"
    ;;
    *)
    ;;
esac

DanielMazurkiewicz avatar Feb 13 '24 08:02 DanielMazurkiewicz

Console log to error code, same thing happening. I'm using KDE Neon. I really wanted to use this AI. It is so annoying that windows guys can use it with a single run.bat. I'll drive crazy.

QXR9 avatar Feb 15 '24 11:02 QXR9

In Nobara (Fedora 39), I'm getting the following error

  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'

stderr:   error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      Traceback (most recent call last):
        File "/media/4TB/AI/automatic1111/stable-diffusion-webui/venv/lib64/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/media/4TB/AI/automatic1111/stable-diffusion-webui/venv/lib64/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/media/4TB/AI/automatic1111/stable-diffusion-webui/venv/lib64/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
          backend = _build_backend()
                    ^^^^^^^^^^^^^^^^
        File "/media/4TB/AI/automatic1111/stable-diffusion-webui/venv/lib64/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
          obj = import_module(mod_path)
                ^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib64/python3.12/importlib/__init__.py", line 90, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
        File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 994, in exec_module
        File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
        File "/tmp/pip-build-env-c23ey_u1/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
          import setuptools.version
        File "/tmp/pip-build-env-c23ey_u1/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
          import pkg_resources
        File "/tmp/pip-build-env-c23ey_u1/overlay/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2172, in <module>
          register_finder(pkgutil.ImpImporter, find_on_path)
                          ^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

EDIT: Managed to launch it, had to manually install python3.10, create local venv with that name. Basically:

sudo dnf install python3-virtualenv
cd stable-diffusion
python3.10 -m venv venv
./web-ui.sh

frozht avatar Feb 18 '24 02:02 frozht

Getting the same errors as OP on Kubuntu 23.10. Unless I'm missing steps somewhere, it just won't install.

DarthBrandon avatar Feb 25 '24 18:02 DarthBrandon

This workaround works for me.

longfin avatar Mar 04 '24 02:03 longfin

Still got the problem and what @longfin suggested didnt work

Schweeeeeeeeeeeeeeee avatar Mar 07 '24 16:03 Schweeeeeeeeeeeeeeee

It's because StableDiffusion WebUI dosn't currently support that specific APU. As @DanielMazurkiewicz alredy noticed, the linux script only checks for Navi1, Navi2, Navi3 and Renoir.

Also, ROCm itself doesn't officially supports those APUs (or any APU in general). But maybe it's possible to make it work with a workaround.

@DanielMazurkiewicz try to add this to your code, let's see if it works: export HSA_OVERRIDE_GFX_VERSION=11.0.0

but then the install still fails for me at some point, because sentencepiece does not support python 3.12 yet (it would probably work if I downgraded to 3.10 as suggested by the installer, but I will just wait for the new version of sentencepiece to bereleased)

Yep, that's the issue in your case. You need to use Python 3.10.6, as it's written on the install guide (actually it should work on Python 3.11 too) It's not only sentencepiece, many dependencies aren't released on 3.12 yet. And Pytorch started supporting it just recently, that's why you couldn't install the 2.0.1 version but 2.2.0 worked fine. I suggest you to just downgrade to 3.11, or use a conda enviroment.

DGdev91 avatar Mar 12 '24 00:03 DGdev91