santa hat
deerdeer nosedeer glow
Sign In

How to install ROCm on ANY form of archlinux or archlinux variant

May 14, 2024
tool guide
How to install ROCm on ANY form of archlinux or archlinux variant

Support is being discontinued, if someone would like to take over, let me know and I'll link your new guide(s)

update: for people who are waiting on windows, it is unlikely they will support older versions, and the probability of the rest on the list at windows support listed being supported is slim, because they are gonna drop rocm in 2-3 years when they release the 8000 series.

note: even more reason to use linux over windows if intent is mostly AI: https://rocm.docs.amd.com/projects/install-on-windows/en/latest/reference/component-support.html

doesnt have hipify or AI pytorch support on their windows ROCM

Additional note: if you have a iGPU, and you have a actual GPU, refer to this guide: https://wiki.archlinux.org/title/hybrid_graphics (edited)

to start:

only archlinux:

sudo pacman -Syyu

only on manjaro:

sudo pacman-mirrors -f && sudo pacman -Syyu

sudo pamac upgrade -a

on both arch and manjaro:

sudo git clone https://aur.archlinux.org/yay-git.git

sudo chown -R [user] ./yay-git

cd yay-git

makepkg -si

finally, for any form of arch, including the ones above:

yay -S git python-virtualenv wget python-pip dpkg make rocm-hip-sdk rocm-opencl-sdk gperftools bc

download: https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tar.xz

extract using ark or whatever

cd to directory

./configure

make

sudo make install

^ all dependencies next do:

Add your user to the render group (replace username with your own).

sudo gpasswd -a username render

sudo gpasswd -a username video

Edit ~/.profile with your editor of choice.

sudo nano ~/.profile

OR

sudo nano /etc/environment

The difference? .profile does the current profile, where as environment does it on bootup, make sure to remove the "export" part if putting in environment.

Paste the following line at the bottom of the file, then press ctrl-x and save the file before exiting.

export HSA_OVERRIDE_GFX_VERSION=10.3.0

(change the version number to 11.0.0 for 7000 series)

Now make sure to restart your computer before continuing.

after reboot

do this in either home folder or you can do:

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

cd stable-diffusion-webui

 

before hand to skip some pain in having to reinstall the pytorch

now activate the venv using

python -m venv venv

. venv/bin/activate
(small note regarding the addition of .fish here, garuda runs the fish shell therefore you need to add .fish for it to work with fish for some reason) edit: alternatively you could use
bash venv/bin/activate to bypass having to use .fish

you will now see "(venv)" beside the front of console

we want to seperate these two commands so that it will install in necessary order for it to install "WHL"

pip install wheel

THEN

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm5.7

Let's verify PyTorch was installed correctly with GPU support, so lets first enter the Python console.

python3

Now enter the following two lines of code. If it returns True then everything was installed correctly.

import torch

torch.cuda.is_available()

Then enter exit() to exit the Python console.

Change this line in webui-user.sh to this:

# python3 executable

python_cmd="/home/$USER/.pyenv/versions/3.10.6/bin/python"

after that run webui.sh remember first gen takes a minute

side note: in addition to the update of 1.7.0 it is really slow to update the requirements first installs on quite a few AMD units

Note: if you get this error:(Only on KDE I had this error)

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/ellia/stable-diffusion-webui/venv/lib/python3.11/site-packages/cv2/qt/plugins" even though it was found.

This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx.

/usr/bin/xdg-open: line 634: 12402 Aborted (core dumped) kde-open${KDE_SESSION_VERSION} "$1"

you need to do 1 thing

1: go to stable-diffusion-webui/venv/lib/python3.11/site-packages/cv2/qt/plugins/platforms/ and delete the xcb file there and re open webui.sh

If you would like to help bring xformers to AMD please refer to this issue and participate testing, make sure to include your specs https://github.com/facebookresearch/xformers/pull/978

added bc to dependencies because it is a command that is used and not in base arch though its new in the SD stuff so Im not 100% sure what it does. but Im assuming a new feature to SD because its not a extension.

20

Comments