看网上部署stable diffusion webui的教程,很简单。而且我也有部署stable diffusion v1/v2的经验,想着应该会很快部署完stable diffusion webui,但是没想到在部署过程中,遇到各种各样的奇葩问题,特此在此记录一下。
stable diffusion webui支持的python版本需大于等于3.10.6,首先conda search python查看conda支持的python版本,我的conda支持到3.11,所以能够创建python=3.10.6的虚拟环境,然而却出现了如下错误。libgcc-ng等的版本不满足要求。

我使用的是清华源,解决方案就是添加conda-forge通道conda config --append channels conda-forge,能够访问https://anaconda.org下载清华源中不存在的包。
在pip install -r requirement_version.txt时,在下载安装basicsr库preparing metadata (setup.py)中卡住一直不动。
解决方案:首先添加–verbose参数查看卡住的原因。pip install --verbose basicsr,输出如下所示:

安装需满足PEP 517,首先输入如下命令pip install --upgrade pip setuptools wheel 升级setuptools的版本。然后再使用命令pip install --verbose basicsr --use-pep517 进行安装。
首先pip install -r requirement_version.txt安装所需要的包,没出问题。检查gfpgan也已经安装成功。

如上图所示,gfpgan和Cython都已经安装好的情况下,运行./webui.sh,出现
Couldn't install gfpgan.和 Error Could not find a version that satisfies the requirement cython。这个问题试了很多方法,总会出现各种各样的bug,最后终于解决。



重新运行./webui.sh,等待一段时间,依序安装所需软件,部署成功。

clip和open_clip的安装问题,在modules/launch_utils.py中将"https://github.com/“更改为"https://kgithub.com/”。
使用xformers,在webui-user.sh中添加export COMMANDLINE_ARGS="--autolaunch --xformers"命令行。
部署环境看着简单,有时候全凭运气。