今天使用Stable Diffusion时,按照常规升级插件,升级后SD启动遇到了报错问题:
Collecting pycairo>=1.20.0
Using cached pycairo-1.23.0.tar.gz (344 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: pycairo
Building wheel for pycairo (pyproject.toml): started
Building wheel for pycairo (pyproject.toml): finished with status 'error'
Failed to build pycairo
stderr: error: subprocess-exited-with-error
× Building wheel for pycairo (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [15 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-13-arm64-cpython-310
creating build/lib.macosx-13-arm64-cpython-310/cairo
copying cairo/__init__.py -> build/lib.macosx-13-arm64-cpython-310/cairo
copying cairo/__init__.pyi -> build/lib.macosx-13-arm64-cpython-310/cairo
copying cairo/py.typed -> build/lib.macosx-13-arm64-cpython-310/cairo
running build_ext
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycairo
ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects
[notice] A new release of pip is available: 23.0 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
Warning: Failed to install svglib, some preprocessors may not work.
仔细看了一下 是controlnet插件更新后,按装svglib 出现了问题:
Installing sd-webui-controlnet requirement: svglib
Couldn't install sd-webui-controlnet requirement: svglib.
Command: "/Users/glodcrab/AI2IMG/stable-diffusion-webui/venv/bin/python3.10" -m pip install svglib --prefer-binary
Error code: 1
这里的问题主要是pycairo
只是对cairo
包的Python绑定。但是cairo 包 并不会被pip进行安装。
在这里,我们通过 Homebrew先安装它。brew install cairo。然后再重新启动SD即可。问题解决。
Mac下解决此问题:
brew install pkg-config
brew install cairo
pip install pycairo
Linux下解决此问题:
sudo apt-get update -y
sudo apt-get install -y pkg-config
sudo apt-get install libcairo2-dev libjpeg-dev libgif-dev
sudo pip install pycairo
可以看到问题解决:
Installing requirements
Installing sd-webui-controlnet requirement: svglib
Installing sd-dynamic-prompts requirements.txt
Launching Web UI with arguments: --skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate
No module 'xformers'. Proceeding without it.