在安装stable difussion的过程中,出现下面的报错
(sd3) root@stwg-desktop:/home/stwg/sd3# bash ./webui.sh -f ################################################################ Install script for stable-diffusion + Web UI Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer. ################################################################ ################################################################ Running on root user ################################################################ ################################################################ Repo already cloned, using it as install directory ################################################################ ################################################################ Create and activate python venv ################################################################ ########################################################## Launching launch.py... ################################################################
glibc version is 2.31 Cannot locate TCMalloc. Do you have tcmalloc or google-perftool installed on your system? (improves CPU memory usage) Python 3.8.10 (default, Jul 29 2024, 17:02:10) [GCC 9.4.0] Version: v1.10.1 Commit hash: 82a973c04367123ae98bd9abdf80d9eda9b910e2 Installing torch and torchvision Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://download.pytorch.org/whl/cu121 Collecting torch==2.1.2 Using cached https://download.pytorch.org/whl/cu121/torch-2.1.2%2Bcu121-cp38-cp38-linux_x86_64.whl (2200.7 MB) Collecting torchvision==0.16.2
Using cached https://download.pytorch.org/whl/cu121/torchvision-0.16.2%2Bcu121-cp38-cp38-linux_x86_64.whl (6.9 MB) Collecting sympy Using cached https://pypi.tuna.tsinghua.edu.cn/packages/b2/fe/81695a1aa331a842b582453b605175f419fe8540355886031328089d840a/sympy-1.13.1-py3-none-any.whl (6.2 MB) Collecting networkx Using cached https://download.pytorch.org/whl/networkx-3.2.1-py3-none-any.whl (1.6 MB)
ERROR: Package 'networkx' requires a different Python: 3.8.10 not in '>=3.9'
Traceback (most recent call last): File "launch.py", line 48, in <module> main() File "launch.py", line 39, in main prepare_environment() File "/home/stwg/sd3/modules/launch_utils.py", line 381, in prepare_environment run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True) File "/home/stwg/sd3/modules/launch_utils.py", line 116, in run raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't install torch. Command: "/home/stwg/sd3/venv/bin/python" -m pip install torch==2.1.2 torchvision==0.16.2 --extra-index-url https://download.pytorch.org/whl/cu121
Error code: 1
下面是ChatGPT4给出的解决思路:
根据你提供的错误信息,主要问题是 networkx
包要求 Python 版本至少为 3.9,而你当前使用的是 Python 3.8.10。为了解决这个问题,你可以考虑以下步骤:
解决方案一:升级 Python 版本
- 升级 Python:升级你的 Python 到 3.9 或更高版本。
- 在 Debian 11 上,可以通过以下命令安装 Python 3.9:
bash
sudo apt update
sudo apt install python3.9 python3.9-venv python3.9-dev
- 确认安装:
bash
python3.9 --version
- 在 Debian 11 上,可以通过以下命令安装 Python 3.9:
- 创建新的虚拟环境:
- 删除当前虚拟环境:
bash
rm -rf /home/stwg/sd3/venv
- 使用 Python 3.9 创建新的虚拟环境:
bash
python3.9 -m venv /home/stwg/sd3/venv
source /home/stwg/sd3/venv/bin/activate
- 删除当前虚拟环境:
- 重新运行安装脚本:
bash
bash ./webui.sh -f
按照上述的方法,已顺利解决
文章评论