[Stable Diffusion] Windows 部署 Stable Diffusion WebUI 的坑

7,619 阅读1分钟

1.RuntimeError: Couldn't install gfpgan.

运行 webui.bat 时的报错如下:

Installing gfpgan
Traceback (most recent call last):
  File "D:\Work\stable-diffusion-webui\launch.py", line 324, in <module>
    prepare_environment()
  File "D:\Work\stable-diffusion-webui\launch.py", line 239, in prepare_environment
    run_pip(f"install {gfpgan_package}", "gfpgan")
  File "D:\Work\stable-diffusion-webui\launch.py", line 106, in run_pip
    return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")
  File "D:\Work\stable-diffusion-webui\launch.py", line 74, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install gfpgan.
Command: "D:\Work\stable-diffusion-webui\venv\Scripts\python.exe" -m pip install git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 --prefer-binary
Error code: 1
stdout: Collecting git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379
  Cloning https://github.com/TencentARC/GFPGAN.git (to revision 8d2447a2d918f8eba5a4a01463fd48e45126a379) to c:\users\cheapmeow\appdata\local\temp\pip-req-build-ww9pc8i8

stderr:   Running command git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git 'C:\Users\CheapMeow\AppData\Local\Temp\pip-req-build-ww9pc8i8'
  error: RPC failed; curl 28 Recv failure: Connection was reset
  fatal: expected flush after ref listing
  error: subprocess-exited-with-error

  git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git 'C:\Users\CheapMeow\AppData\Local\Temp\pip-req-build-ww9pc8i8' did not run successfully.
  exit code: 128

  See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

git clone --filter=blob:none --quiet https://github.com/TencentARC/GFPGAN.git 'C:\Users\CheapMeow\AppData\Local\Temp\pip-req-build-ww9pc8i8' did not run successfully.
exit code: 128

See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip available: 22.2.1 -> 22.3.1
[notice] To update, run: D:\Work\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip

解决方法:

根据 stackoverflow.com/questions/7…

在 venv/Lib/site-packages 中打开 cmd 然后执行 pip install package_name -t .

RuntimeError: Couldn't install gfpgan.RuntimeError: Couldn't install clip. 同理

特殊的是,对于 open_clip,名字实际上是 open_clip_torch,所以应该执行 pip install open_clip_torch -t .

2.换线路或重复运行 webui.bat

clone 失败主要是跟 git 命令内部的什么操作有关……我也不懂

所以只能寄希望于这种玄学了

有的时候还真的有用