Sign In

Stable Diffusion, AUTOMATIC1111 and Python Venv

0
Stable Diffusion, AUTOMATIC1111 and Python Venv

Preface

The creation of AI images as well as the model development is done by me with the help of the famous web user interface AUTOMATIC1111. The whole thing is performed on a individual self assembled machine using the operating system Linux. The distributions I use on all my different machines are Debian derivates.

AUTOMATIC1111 handles the installation of all modules so that the web user interface can be used immediately after installation. As most of the readers know, one special feature of AUTOMATIC1111 is the fact, that Extensions of all kind can be post-installed.

Sometimes it can be that the post-installation of Extensions leads to problems of the form, that Python modules are missing. These have to be installed, that stable diffusion shows no error while starting the local server.

Background Information

Python runs in an virtual environment when we talking about the local installation of stable diffusion and the installation of the web user interface AUTOMATIC1111. Installing Python modules has to taken this in account. The installation procedure of Python modules everybody is familiar with will not work in this context.

Preliminary Note For What Follows

I tried to install the TensorRT Extension for testing purposes which failed and which crashed by installation of stable diffusion and AUTOMATIC1111 completely. After recovering the installation the last warning while start-up of the local server the last days was the missing Python module insightface. I use this missing module for my explanation.

Installation Procedure

Using the Python module insightface as an example, I show how missing Python modules can be easily installed.

First of all go to the directory where stable diffusion is installed. In my case it looks like

/home/valhalla/ssd-sandisk/stable-diffusion-webui/

Then on needs to switch to the Python Virtual Environment. This is done by the following command under Linux

source ./venv/bin/activate

Now the User Prompt

thor@valhalla:~/ssd-sandisk/stable-diffusion-webui$

changes to the new User Prompt

(venv) thor@valhalla:~/ssd-sandisk/stable-diffusion-webui$

where (venv) shows that we are now in Python Virtual Environment.

The next step is as it is known using the Python program pip

pip install insightface

The program pip is used to install the Python module insightface from the PyPI repository.

In case of insightface one will find after installation the following directory in the subdirectory venv.

/home/valhalla/ssd-sandisk/stable-diffusion-webui/venv/insightface

The procedure will work most of the time in a very well way. This procedure failed e.g. for the installation of xformers. But that is a different story.

Final Words

Have a nice day. Have fun. Be inspired!

References

[1] https://docs.python.org/3.10/library/venv.html

0

Comments