【瑞模网】新版SD WebUI卡安装Open_Clip解决方法

最近不少人遇到更新了A1111的Stable Diffusion WebUI后, 启动后下载Open Clip失败, 提示"RuntimeError: Couldn't install open_clip." 等.

该问题出现的原因是国内特殊网络环境无法正常连接到该github仓库, 进而没法下载open_clip导致的.

所以解决方法也很简单, 主要分为三个:

  1. 解决网络环境问题, 可以在路由端进行科学的上网环境布置, 使得pip与git的流量可以经过代理, 这是算是比较根本上的解决了, 可以解决日后的大部分同类型问题..
  2. 或者如果你在使用某个长得像猫猫的东西(CFW), 用TUN mode也能解决.
  3. 用Steam++(Watt Toolkit)/fastgit来给git加速/代理, 我个人没试过, 不过或许可行.
  4. 手动安装国内源/镜像的open_clip,针对性的解决该问题.

这里详细的讲下三,前俩网上有挺多教程, 我就不赘述了.

Traceback (most recent call last):
  File "C:\ufhy\Stable-Diffusion\launch.py", line 307, in <module>
    prepare_environment()
  File "C:\ufhy\Stable-Diffusion\launch.py", line 230, in prepare_environment
    run_pip(f"install {openclip_package}", "open_clip")
  File "C:\ufhy\Stable-Diffusion\launch.py", line 93, 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 "C:\ufhy\Stable-Diffusion\launch.py", line 64, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install open_clip.
Command: "C:\ufhy\Stable-Diffusion\venv\Scripts\python.exe" -m pip install git+https://github.com/mlfoundations/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b --prefer-binary
Error code: 1
stdout: Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting git+https://github.com/mlfoundations/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b
  Cloning https://github.com/mlfoundations/open_clip.git (to revision bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b) to c:\users\ufhy\appdata\local\temp\pip-req-build-nz0isd2g

stderr:   Running command git clone --filter=blob:none --quiet https://github.com/mlfoundations/open_clip.git 'C:\Users\ufhy\AppData\Local\Temp\pip-req-build-nz0isd2g'
  fatal: unable to access 'https://github.com/mlfoundations/open_clip.git/': Failed to connect to github.com port 443 after 21140 ms: Timed out
  error: subprocess-exited-with-error

  git clone --filter=blob:none --quiet https://github.com/mlfoundations/open_clip.git 'C:\Users\ufhy\AppData\Local\Temp\pip-req-build-nz0isd2g' 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/mlfoundations/open_clip.git 'C:\Users\ufhy\AppData\Local\Temp\pip-req-build-nz0isd2g' 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.

这是详细的报错代码, 我们可以注意到, 其中的重点是:` "C:\ufhy\Stable-Diffusion\venv\Scripts\python.exe" -m pip install git+https://github.com/mlfoundations/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b --prefer-binary`

我们分析一下, "C:\ufhy\Stable-Diffusion\venv\Scripts\python.exe"是你SD WebUI里venv虚拟环境里的python,这行命令期望这个SD WebUI独享的python, 通过git, 用pip安装"https://github.com/mlfoundations/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b".

前面这个"[Stable-Diffusion根目录]\venv\Scripts\python.exe"需要把你的SD WebUI修改进去.例如说, 你的SD WebUI安装在E盘的`AI_art`下的`SD_WebUI`文件夹里,那么你需要把前面这段替换为`E:\AI_art\SD_WebUI\venv\Scripts\python.exe`

我们只需要替换github这个链接为我们能正常访问的网站即可.比如:

Gitee的: https://gitee.com/ufhy/open_clip

或者其他github镜像源的也行,只要你能访问.

替换后为:

```

"E:\AI_art\SD_WebUI\venv\Scripts\python.exe" -m pip install git+https://gitee.com/ufhy/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b --prefer-binary

```

既然你已经指定了python(记得替换为你自己的), 所以你可以在任意的地方打开powershell然后执行以上代码, 然后静候即可.

现在, 你应该看到了进度条在前进, 如果没有, 请检查是否开启了代理类软件, 将其关闭, 祝你好运. 

猜你喜欢

转载自blog.csdn.net/rrmod/article/details/130752024