部署本地化stable-diffusion遇到问题,求解

在尝试运行stable-diffusion-webui时,使用Python3.10.6和conda环境遇到了错误。错误指出Torch无法使用GPU,因为似乎加载了PyTorch仓库中的_C文件夹而非预期的C扩展。这可能由于使用了`install`工作流而非`develop`工作流导致。解决方案包括使用正确的安装流程或从不同目录运行Python。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

(stable-diffusion-webui) C:\Users\qinch\stable-diffusion-webui>webui-user.bat

venv "C:\Users\q\stable-diffusion-webui\venv\Scripts\Python.exe"

Python 3.10.6 | packaged by conda-forge | (main, Oct 24 2022, 16:02:16) [MSC v.1916 64 bit (AMD64)]

Commit hash: 076d624a297532d6e4abebe5807fd7c7504d7a73

Traceback (most recent call last):

File "C:\Users\q\stable-diffusion-webui\launch.py", line 360, in <module>

prepare_environment()

File "C:\Users\q\stable-diffusion-webui\launch.py", line 272, in prepare_environment

run_python("import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'")

File "C:\Users\q\stable-diffusion-webui\launch.py", line 129, in run_python

return run(f'"{python}" -c "{code}"', desc, errdesc)

File "C:\Users\q\stable-diffusion-webui\launch.py", line 105, in run

raise RuntimeError(message)

RuntimeError: Error running command.

Command: "C:\Users\q\stable-diffusion-webui\venv\Scripts\python.exe" -c "import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'"

Error code: 1

stdout: <empty>

stderr: Traceback (most recent call last):

File "<string>", line 1, in <module>

File "C:\Users\q\stable-diffusion-webui\venv\lib\site-packages\torch\__init__.py", line 235, in <module>

raise ImportError(textwrap.dedent('''

ImportError: Failed to load PyTorch C extensions:

It appears that PyTorch has loaded the `torch/_C` folder

of the PyTorch repository rather than the C extensions which

are expected in the `torch._C` namespace. This can occur when

using the `install` workflow. e.g.

$ python setup.py install && python -c "import torch"

This error can generally be solved using the `develop` workflow

$ python setup.py develop && python -c "import torch" # This should succeed

or by running Python from a different directory.

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值