MacOS安装Stable Diffusion WebUI时basicsr安装OSError报错求助
问题详情
运行./web-ui.sh脚本时触发以下错误:
OSError: [Errno 66] Directory not empty: '/private/var/folders/8h/x8kgqp2x2h3gryh9v7v9f8r00000gp/T/pip-install-r5hyfavd/basicsr_ec8eabc4b9e0466487ec10fcf881f174/.eggs/Cython-3.0.5-py3.10-macosx-10.9-universal2.egg/Cython-3.0.5.dist-info' -> '/private/var/folders/8h/x8kgqp2x2h3gryh9v7v9f8r00000gp/T/pip-install-r5hyfavd/basicsr_ec8eabc4b9e0466487ec10fcf881f174/.eggs/Cython-3.0.5-py3.10-macosx-10.9-universal2.egg/EGG-INFO'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> basicsr
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
[notice] A new release of pip available: 22.2.2 -> 23.3.1
[notice] To update, run: pip install --upgrade pip
原因说明:这是pip安装basicsr时的临时目录冲突问题——系统尝试将Cython-3.0.5.dist-info重命名为EGG-INFO,但目标目录已存在且非空,并非basicsr包本身的问题。
解决步骤
1. 升级pip
先按照提示升级pip到最新版本,避免版本兼容问题:
# 如果使用了WebUI的虚拟环境,先激活 cd /你的WebUI目录路径 source venv/bin/activate # 升级pip pip install --upgrade pip
2. 清理缓存与残留文件
清除pip缓存
pip cache purge
删除报错中的临时安装目录
直接删除报错里指定的临时目录:
rm -rf /private/var/folders/8h/x8kgqp2x2h3gryh9v7v9f8r00000gp/T/pip-install-r5hyfavd/
如果找不到对应路径,也可以先查看pip临时目录位置:
pip install --help | grep -A 1 "temp-dir"
再用rm -rf命令删除该目录。
3. 重新运行安装脚本
回到WebUI目录,重新执行安装脚本:
cd /你的WebUI目录路径 ./web-ui.sh
4. 备选:手动安装basicsr
如果上述步骤无效,尝试手动安装basicsr:
# 激活虚拟环境(若使用) source venv/bin/activate # 无缓存安装basicsr pip install basicsr --no-cache-dir
安装完成后再运行./web-ui.sh。
内容的提问来源于stack exchange,提问作者n_v_e_younes

