安装依赖失败
首次启动服务时,stable-diffusion-webui 需要下载大量依赖包,主要会出现以下情况:
卡住不动:大概率是网络不佳,因为有些依赖资源地址在国内是无法访问的,这时需全程启用代理,避免网络连接问题。
下载报错:有些依赖版本和自身系统不兼容,会导致报错,这时可根据具体报错信息去网上搜索解决方案。
启动成功,但部分依赖下载失败:可以通过手动安装来解决此类问题(例如在项目根路径下执行 pip3 install xxx,至于执行什么命令可根据报错信息中的提示进行尝试)。
Mac 常见错误
ERROR: No matching distribution found for tensorflow
Error running install.py for extension /Users/lencx/github/lencx/ai-art/stable-diffusion-webui/extensions/sd_smartprocess.
Command: "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/venv/bin/python3" "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/extensions/sd_smartprocess/install.py"
Error code: 1
stdout: loading Smart Crop reqs from /Users/lencx/github/lencx/ai-art/stable-diffusion-webui/extensions/sd_smartprocess/requirements.txt
Checking Smart Crop requirements.
stderr: Traceback (most recent call last):
File "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/extensions/sd_smartprocess/install.py", line 9, in <module>
run(f'"{sys.executable}" -m pip install -r "{req_file}"', f"Checking {name} requirements.",
File "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/launch.py", line 97, in run
raise RuntimeError(message)
RuntimeError: Couldn't install Smart Crop requirements..
Command: "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/venv/bin/python3" -m pip install -r "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/extensions/sd_smartprocess/requirements.txt"
Error code: 1
stdout: Collecting ipython==8.6.0
Using cached ipython-8.6.0-py3-none-any.whl (761 kB)
Collecting seaborn==0.12.1
Using cached seaborn-0.12.1-py3-none-any.whl (288 kB)
stderr: ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
解决方案:打开 stable-diffusion-webui/extensions/sd_smartprocess/requirements.txt 文件修改 tensorflow 为 tensorflow-macos,这是因为在 mac 上匹配不到 tensorflow 安装包,将其修改为 tensorflow-macos 即可。
What is the proper way to install TensorFlow on Apple M1 in 2022([38])
Get started with tensorflow-metal([39])
ModuleNotFoundError: No module named ‘fairscale’
Civitai: API loaded
Error loading script: main.py
Traceback (most recent call last):
File "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/modules/scripts.py", line 256, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/extensions/sd_smartprocess/scripts/main.py", line 3, in <module>
from extensions.sd_smartprocess import smartprocess
File "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/extensions/sd_smartprocess/smartprocess.py", line 15, in <module>
from extensions.sd_smartprocess.clipinterrogator import ClipInterrogator
File "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/extensions/sd_smartprocess/clipinterrogator.py", line 14, in <module>
from models.blip import blip_decoder, BLIP_Decoder
File "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/repositories/BLIP/models/blip.py", line 11, in <module>
from models.vit import VisionTransformer, interpolate_pos_embed
File "/Users/lencx/github/lencx/ai-art/stable-diffusion-webui/repositories/BLIP/models/vit.py", line 21, in <module>
from fairscale.nn.checkpoint.checkpoint_activations import checkpoint_wrapper
ModuleNotFoundError: No module named 'fairscale'
解决方案:手动安装 fairscale 依赖(相关 issue:installed but it says ModuleNotFound?([40]))
pip3 install fairscale