AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
142.79k stars 26.92k forks source link

Update Linux Install Instructions #15881

Open OttCS opened 5 months ago

OttCS commented 5 months ago

Is there an existing issue for this?

What would your feature do ?

After filing #15384 and getting some feedback from other users having this same problem and finding a common solution, I put together a guide for installing on more modern Linux distros. Incorporating this into the wiki/readme would be extremely valuable for bringing on new users.

Proposed workflow

My installation guide: https://github.com/OttCS/OttCS/blob/main/blog/2024/5/linux-automatic1111-sd.md

Additional information

I couldn't get feedback in the developer discord for how to contribute to the wiki, if someone could explain how to do that I'd be glad to do it myself.

ClashSAN commented 5 months ago

Ubuntu 24 and the new 22 versions have dropped python3.10, so the wiki installation method was outdated.

Thanks for checking Fedora and opensuse.

Arch linux: According to some users here, you can obtain and create the 3.10 python venv with the AUR packages.

I edited the linux section to provide details for the python obtaining processes in the 3 major distributions. If you'd like to TouchUp some part specifically, copying a section and asking the "collaborators" (someone that can edit the wiki) to make the changes would work.

Asherathe commented 5 months ago

On OpenSUSE Tubleweed, the default webui-user.sh works fine. I'm running A1111 with Python 3.11.9 without any issues.

I would mention that --xformers is Nvidia only, and AMD users should use sub-quad optimization instead, with --upcast-sampling.

You might also add that the user needs to be added to the render group, and export HCC_AMDGPU_TARGET=gfx**** might need to be added to .bashrc. I think that solves the problems a lot of Linux users face getting started.

OttCS commented 5 months ago

@ClashSAN Thanks for updating the instructions! Too bad there's not an easier method for updating the wiki, but at least I might put in a PR for the instructions on the main README.

@Asherathe I'll definitely add the information about optimization for AMD, a lot of Linux systems have those GPUs. The info about .bashrc and render groups might be distro specific, and Nobara Linux might come with those patches for general gaming. I'll take a look when I can.

Mershl commented 5 months ago

Thanks for compiling the info in one place. Some late feedback on the current doc:

sudo dnf install python3.10

The procedure differs vastly depending on the distro. the alternatives command comes to mind. I'd propose explicitly stating it's a Fedora/CentOS/RHEL dependencies chapter written for Fedora XY to make it clear for new users. Other distro users can add their chapter to the guide.

Python environments are too much work, especially since there's a much easier option.

webui.sh will still create and setup a Python (Virtual) environment for you in [repo_folder]/venv. The line can be removed.

Dependencies

If you're running the Fedora 40 "Minimal" Image (all toolbx users will use this) the pciutils package will be missing. A1111 relies on lspci to detect an AMDGPU, else it will default to the CUDA version of pytorch.

Dependencies

A1111 uses tcmalloc as an optimization if it is available. tcmalloc is provided by gperftools on Fedora. Missing tcmalloc should be visible in the startup output of ./webui.sh

If you want to always use your arguments without forgetting them, just create another shell file

webui-user.sh provides COMMANDLINE_ARGS for this usecase (see https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/webui-user.sh#L13C9-L13C25)

photograph of an astronaut riding a horse

I've heard "photograph of a horse riding an astronaut" is the new Hello World

On a side note: there is still an issue with the pydantic python package in the default installer when using the controlnet extension where you have to manually downgrade pydantic in requirements.txt. I'll write something up once I'm home again.

OttCS commented 5 months ago

@Mershl I've fixed the environments line, added the required dependencies, and fixed where the command-line arguments go. I'd love to collaborate with others on this as well, as I can only do so much Linux testing.

Given these changes, I'm reopening the issue and requesting that the wiki (somehow) directly reference the written guide at https://github.com/OttCS/OttCS/blob/main/blog/2024/5/linux-automatic1111-sd.md.

Asherathe commented 5 months ago

@Mershl I've fixed the environments line, added the required dependencies, and fixed where the command-line arguments go.

On OpenSUSE Tumbleweed, tcmalloc is provided by libtcmalloc4. Gperftools-devel will install this as a dependency, but gperftools will not. Libtcmalloc4 will work on its own without any version of gperftools installed.

Lspci seems to be provided by pciutils, so I'm not sure if they need to be listed separately.

ClashSAN commented 5 months ago

A1111 relies on lspci to detect an AMDGPU, else it will default to the CUDA version of pytorch.

@Mershl If this is happening not just in fedora, might be a good idea to raise a separate issue or PR patching the installer to quit before installing the cuda version.

@OttCS If you want, I will add this here:

Third party installation guides/scripts:

And to the guides section.

So there is presently is lots of redundant optimization tips in the wiki, linking to the optimizations page is preferred.

I personally did not think that the Linux section needed a guide, just those commands, but of course it would be more helpful for newcomers.

Some optimizations have yet to be added, the ones that come to mind are TAESD, which result in tremendous savings, very useful on AMD systems with no flash attention optimizations.

Forking the repository and editing the wiki there would help for viewing the changes. If you all wanted to do edits.

@Asherathe I don't know if export HCC_AMDGPU_TARGET=gfx**** should be added to the autoinstaller for everyone, I found your other comment about this for rocm 2.3.0 (or some new version) that may have been unintended by the people managing the autoinstaller. But maybe you could add this as a draft PR for those with AMD setups to test?

OttCS commented 5 months ago

@ClashSAN Given the different needs of each Linux OS, I've created a new Linux Repo just for Fedora/Nobara. I've been maintaining the Nobara article on my "blog" but seeing that the project is open to including third-party installation guides/scripts, I'll create my own following the same format as the Nix one.

OttCS commented 4 months ago

The Fedora/Nobara Guide is complete. I still don't know how to edit the wiki, so here's the link for somebody to add:

https://github.com/OttCS/automatic1111-webui-fedora

I'll close the issue once it's been added.

thediveo commented 5 days ago

The instructions for Ubuntu refer to the deadsnakes repo to install Python 3.10, but as of Ubuntu 24.10 and this writing this repository does not work for Ubuntu 24.10.

E: The repository 'https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu oracular Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.