lshqqytiger / stable-diffusion-webui-amdgpu

Stable Diffusion web UI
GNU Affero General Public License v3.0
1.87k stars 191 forks source link

[Bug]: ImportError: DLL load failed while importing onnxruntime_pybind11_state: The Dynamic Link Library (DLL) initialization program has failed. #487

Closed Agubigubagada closed 4 months ago

Agubigubagada commented 4 months ago

Checklist

What happened?

After the first launch (with installation) and the following launches, I get this error: ImportError: DLL load failed while importing onnxruntime_pybind11_state: Произошел сбой в программе инициализации библиотеки динамической компоновки (DLL). (translation: There was a failure in the Dynamic Link Library initialization program (DLL)).

Steps to reproduce the problem

  1. Git clone stable-diffusion-webui-amdgpu
  2. set COMMANDLINE_ARGS= --use-directml
  3. Start webui-user.bat

What should have happened?

WebUI launch

What browsers do you use to access the UI ?

No response

Sysinfo

Sysinfo.txt

Console logs

venv "D:\SD\stable-diffusion-webui-amdgpu\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.9.3-amd-29-g0bde866e
Commit hash: 0bde866ea77e48f9b57e6843531abbe81361883b
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
D:\SD\stable-diffusion-webui-amdgpu\venv\lib\site-packages\pytorch_lightning\utilities\distributed.py:258: LightningDeprecationWarning: `pytorch_lightning.utilities.distributed.rank_zero_only` has been deprecated in v1.8.1 and will be removed in v2.0.0. You can import it from `pytorch_lightning.utilities` instead.
  rank_zero_deprecation(
Launching Web UI with arguments: --use-directml
Traceback (most recent call last):
  File "D:\SD\stable-diffusion-webui-amdgpu\launch.py", line 48, in <module>
    main()
  File "D:\SD\stable-diffusion-webui-amdgpu\launch.py", line 44, in main
    start()
  File "D:\SD\stable-diffusion-webui-amdgpu\modules\launch_utils.py", line 689, in start
    import webui
  File "D:\SD\stable-diffusion-webui-amdgpu\webui.py", line 13, in <module>
    initialize.imports()
  File "D:\SD\stable-diffusion-webui-amdgpu\modules\initialize.py", line 35, in imports
    from modules import shared_init
  File "D:\SD\stable-diffusion-webui-amdgpu\modules\shared_init.py", line 8, in <module>
    from modules.zluda import initialize_zluda
  File "D:\SD\stable-diffusion-webui-amdgpu\modules\zluda.py", line 5, in <module>
    import onnxruntime as ort
  File "D:\SD\stable-diffusion-webui-amdgpu\venv\lib\site-packages\onnxruntime\__init__.py", line 57, in <module>
    raise import_capi_exception
  File "D:\SD\stable-diffusion-webui-amdgpu\venv\lib\site-packages\onnxruntime\__init__.py", line 23, in <module>
    from onnxruntime.capi._pybind_state import ExecutionMode  # noqa: F401
  File "D:\SD\stable-diffusion-webui-amdgpu\venv\lib\site-packages\onnxruntime\capi\_pybind_state.py", line 32, in <module>
    from .onnxruntime_pybind11_state import *  # noqa
ImportError: DLL load failed while importing onnxruntime_pybind11_state: Произошел сбой в программе инициализации библиотеки динамической компоновки (DLL).

Additional information

No response

ezedesa commented 4 months ago

Same error today.

smonte28 commented 4 months ago

also getting the same error

trevortai commented 4 months ago

I found that this issue was related to the latest onnxruntime-directml==1.18.1, reported here:

https://github.com/microsoft/onnxruntime/issues/21270

Try reverting to the previous version with

pip install onnxruntime-directml==1.18.0
Agubigubagada commented 4 months ago

I found that this issue was related to the latest onnxruntime-directml==1.18.1, reported here:

microsoft/onnxruntime#21270

Try reverting to the previous version with

pip install onnxruntime-directml==1.18.0

I just tried it and it didn't work, I also tried this command with a clean install BEFORE launching webui-user.bat, it didn't work either

trevortai commented 4 months ago

I found that this issue was related to the latest onnxruntime-directml==1.18.1, reported here: microsoft/onnxruntime#21270 Try reverting to the previous version with

pip install onnxruntime-directml==1.18.0

I just tried it and it didn't work, I also tried this command with a clean install BEFORE launching webui-user.bat, it didn't work either

Just to make sure everything is working right, do the following:

Agubigubagada commented 4 months ago

I found that this issue was related to the latest onnxruntime-directml==1.18.1, reported here: microsoft/onnxruntime#21270 Try reverting to the previous version with

pip install onnxruntime-directml==1.18.0

I just tried it and it didn't work, I also tried this command with a clean install BEFORE launching webui-user.bat, it didn't work either

Just to make sure everything is working right, do the following:

  • Delete the venv folder
  • cd to the stable diff folder
  • in conda or terminal: webui.bat --use-directml or set --use-directml to cmd line args with webui-user.bat like you did
  • you should get the .dll error
  • enter the venv with: .\venv\scripts\activate
  • enter: pip install onnxruntime-directml==1.18.0 - this should replace 1.18.1
  • optionally also do pip install onnxruntime==1.18.0 - just in case? I haven't had issues yet
  • launch with: webui.bat --use-directml or use cmd line args
  • It should launch

This method helped me and is the solution to this problem. Thank you.

smonte28 commented 4 months ago

This worked for me as well, thank you!