Running AUTOMATIC1111 / stable-diffusion-webui on Clear Linux? Tips for Linux newbies like me

UPDATE! Please note.

Pyenv does not play nicely with CL anymore. Use Conda.


Instructions below are no longer valid!


If you are a Linux newbie like me and try to run stable-diffusion-webui (SDW) on Clear Linux (CL), to your surprise, it will fail to run. That is because CL has the Python version 3.11. SDW needs 3.10.6.

First hurdle is installing CL if you have a NVIDIA graphics card not supported by the nuveau opensource driver. CL desktop older releases won’t even boot. Release 38400 luckily boots to the text only user interface (Kudos to the os development team) and then it can be installed. Are you disappointed that there is no iso version of the desktop? Rufus creates a bootable USB with the live-desktop img.xz file on windows. If you are brave, you can try dd if of bs=4M after decompressing it! Remember to make the USB in GPT and not MBR.

Second hurdle is installing the proprietary NVIDIA driver. Thanks to @marioroy it is relatively easy using his github repo. It will be even easier if you know how to SSH as you can copy and paste the lengthy commands. I have the driver version 525 running.

As far as I know, CL Python version should not be downgraded. Instead, one should install pyenv. Pyenv installation fails spectacularly because of missing bundles. Thanks to @tvst this could be sorted out with;

sudo swupd bundle-add devpkg-ncurses sqlite devpkg-openssl tcl-basic devpkg-readline devpkg-bzip2 devpkg-sqlite-autoconf devpkg-libffi devpkg-xz user-basic-dev desktop-dev

Then run;

curl https://pyenv.run | bash

Add the entries to ~/.bashrc by running the following in your terminal:

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc

Then restart the shell, and run;

pyenv install 3.10.6
pyenv global 3.10.6

SDW use TCMalloc library. So install the bundle gperftools.

sudo swupd bundle-add devpkg-gperftools

Now SDW will run fine. I also added --xformers to the command line arguments in webui-user.sh file. If you do not have a recent NVIDIA graphics card, I am sorry, you are left out of the fun.

Credits to

1 Like