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

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 osdevelopment 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

Then run;

curl | bash

I am yet to learn more about bash and profiles. So, I added all these commands.

‘’ First, add the commands 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, if you have ~/.profile, ~/.bash_profile or ~/.bash_login, add the commands there as well. If you have none of these, add them to ~/.profile.

to add to ~/.profile:

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

to add to ~/.bash_profile:

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

Then restart the shell, and run;
pyenv install 3.10.6
pyenv global 3.10.6

Now SDW will run fine. I also added --xformers to the command line arguments in 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