Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ...RuntimeError: D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1029 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Program Files\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_providers_tensorrt.dll" #312

Closed
chelsea456 opened this issue Oct 9, 2022 · 40 comments
Labels
bug Something isn't working stale

Comments

@chelsea456
Copy link

chelsea456 commented Oct 9, 2022

when i run rembg gpu has it error : RuntimeError: D:\a_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1029 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Program Files\Python310\lib\site-packages\onnxruntime\capi\onnxruntime_providers_tensorrt.dll"

@chelsea456 chelsea456 added the bug Something isn't working label Oct 9, 2022
@dandumit
Copy link

I have the same issue. when you find a solution please share.

@chelsea456
Copy link
Author

I have the same issue. when you find a solution please share.

I don't find solution, but i run on window is activate but on macos has error

@togaiaoi
Copy link

I also have the same issue on windows 11.

@noDGodiaev
Copy link

The same issue on Win10

noDGodiaev added a commit to noDGodiaev/remove_background that referenced this issue Oct 16, 2022
@Andebugulin
Copy link

The same issue, smth always happens while working with c++ :(

@Jangsoodlor
Copy link

pip uninstall rembg[gpu] onnxruntime-gpu
Works for me. But you won't be able to use GPU acceleration (Which based on my research seems to only supports NVIDIA GPUs for inferencing (I could be wrong though)).

@disconnect00
Copy link

I've found a solution for this. I changed my installed Python folder from C:\Users to D:. I think it's a permission issue. I'm using Windows 10

@baimoda
Copy link

baimoda commented Nov 26, 2022

重新安装包‘onnxruntime’,问题解决了

@baimoda
Copy link

baimoda commented Nov 26, 2022

我用的是win10,就是package的问题,重新安装onnxruntime,解决问题。

@NeoNeetPro
Copy link

I also have same issue.

@hansnolte
Copy link

The same problem also with the new v2.0.30 version.
I have tried the suggestions of jangsoodlor and disconnect00, both unfortunately without success.
Does anyone else have any tips?

I am on Win 10.

@oldoty-moco
Copy link

I am also facing the same problem on Windows 10, v2.0.30. I have tried re-installing the appropriate versions of CUDA, ONNX Runtime and cuDNN to no avail.

@gopfranco
Copy link

I changed the install directory to one in my Documents folder and that seemed to fix it.

@TinyGiraffeCpp
Copy link

New here, can you please tell how to change the install directory ? Thank you

@JimGaleForce
Copy link

JimGaleForce commented Jan 13, 2023

Win10: For me, it appears this was because of multiple python installations. The traceback path showed 2 different paths, miniconda3 and python39. I also have python310 installed. I solved it by putting on another machine that only has one python installation. However, another way might be to rename all python folders, except one, so that the PATH variables only resolve to one. Hopefully, it's the same one as the onnx lib install. Otherwise, you may have to reinstall this package. ANOTHER way, if other apps are not dependent on your current installs is simply to uninstall all python, reinstall one python, then install this package. HTH

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Feb 13, 2023
@github-actions
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

@treksis
Copy link

treksis commented Mar 10, 2023

same issue here.

@glmcdona
Copy link

glmcdona commented Mar 12, 2023

Same issue here. I had a look with procmon to investigate, and the problem is that onnxruntime_providers_tensorrt.dll has dependencies (imports) from the following dlls and fails to load because it is not finding them in the library load path search:

  • cublas64_11.dll --> CUDA 11.x
  • cudart64_110.dll --> CUDA 11.x
  • cudnn64_8.dll --> cuDNN 8.x
  • nvinfer_plugin.dll --> NVIDIA TensorRT
  • nvinfer.dll --> NVIDIA TensorRT

So this issue is because TensorRT, CUDA 11.x, or cuDNN verison 8.x is not installed or not added to path yet.

The one most commonly missing is probably TensorRT for CUDA 11.x:

Install CUDA 11.x:
https://developer.nvidia.com/cuda-downloads

CuDNN 8.x for CUDA 11.x, matching the above TensorRT version requirement:
https://developer.nvidia.com/cudnn

And don't forget them to add all the /bin and /lib folders that have all the dlls to your PATH system environment variables and restart your terminal.

My issue was installing TensorRT and adding it to path, this fixed it to get the next error for me.

Upon running, it eventually got to a different error stating that TensorRT was linked to cuDNN 8.6.0, while I had cuDNN 8.3.0 installed. The next step was adding cuDNN 8.6.0 as well, and making sure it's path was before my older version. You have click the "Archive" button on the cuDNN download page to see all versions.

Hope this helps someone!

@judy
Copy link

judy commented Mar 15, 2023

Absolutely helped, thank you! I didn't know about procmon either, that's going to be a very useful tool in the future.

I referred to your solution in this thread where people are having the same issue.

@treksis
Copy link

treksis commented Mar 18, 2023

I solved with

pip install -r requirements.txt --ignore-installed

I got some warning stuffs but it works

image

@sanyuzhang
Copy link

Works for me:

pip uninstall rembg //uninstall rembg
pip uninstall onnxruntime //uninstall onnxruntime
pip install rembg[gpu] onnxruntime-gpu //install rembg with GPU support

@UnsleepingCat
Copy link

Works for me:

pip uninstall rembg //uninstall rembg
pip uninstall onnxruntime //uninstall onnxruntime
pip install rembg[gpu] onnxruntime-gpu //install rembg with GPU support

this doesn't work at all

@Zyin055
Copy link

Zyin055 commented Jun 8, 2023

I went down the rabbit hole of trying to get it working on the GPU on Windows. It's not worth the hassle, just uninstall the GPU version and let it use the CPU, it's plenty fast. Thanks @Jangsoodlor pip uninstall rembg[gpu] onnxruntime-gpu

@FoliAGEQBS
Copy link

对我有用:

pip uninstall rembg //uninstall rembg
pip uninstall onnxruntime //uninstall onnxruntime
pip install rembg[gpu] onnxruntime-gpu //install rembg with GPU support

这根本不起作用

If it does not work, please make sure you use the python in the Stable-Diffusion directory

@youuoypi
Copy link

how to use the python in the SD directory? Thank you.

@duoduo369
Copy link

Works for me.win 11

秋叶stable diffussion整合包,首先关闭运行的ui。

找到里面的python.exe后

.\python.exe -m pip uninstall rembg[gpu] onnxruntime-gpu

image

@Jasson
Copy link

Jasson commented Jan 2, 2024

Works for me.win 11

秋叶stable diffussion整合包,首先关闭运行的ui。

找到里面的python.exe后

.\python.exe -m pip uninstall rembg[gpu] onnxruntime-gpu

image

在执行install解决问题

@nightwalker89
Copy link

Works for me:

pip uninstall rembg //uninstall rembg
pip uninstall onnxruntime //uninstall onnxruntime
pip install rembg[gpu] onnxruntime-gpu //install rembg with GPU support

Thank

@shynesss
Copy link

shynesss commented Feb 1, 2024

Works for me.win 11

秋叶stable diffussion整合包,首先关闭运行的ui。

找到里面的python.exe后

.\python.exe -m pip uninstall rembg[gpu] onnxruntime-gpu

image

thanks!

@7kms
Copy link

7kms commented Mar 4, 2024

Works for me:

pip uninstall rembg //uninstall rembg
pip uninstall onnxruntime //uninstall onnxruntime
pip install rembg[gpu] onnxruntime-gpu //install rembg with GPU support

It's really help me. By the way, you should be care with your python location, especially your executable python isn't the golbal one.
For me,because of I use a embeding python, so I should exec as below:

.\system\python\python.exe -m 'pip' uninstall rembg
.\system\python\python.exe -m 'pip' uninstall onnxruntime
.\system\python\python.exe -m 'pip' install rembg[gpu] onnxruntime-gpu

@Nico-07
Copy link

Nico-07 commented Mar 16, 2024

Works for me.win 11

秋叶stable diffussion整合包,首先关闭运行的ui。

找到里面的python.exe后

.\python.exe -m pip uninstall rembg[gpu] onnxruntime-gpu

image

THANKS

@tkz24589
Copy link

tkz24589 commented May 17, 2024

see https://onnxruntime.ai/docs/install/, install onnxruntime-gpu in [pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/]. good!

@aswordok
Copy link

是package的问题,重新安装onnxrunti

U are right.

@hushanhsiang
Copy link

Works for me:

pip uninstall rembg //uninstall rembg
pip uninstall onnxruntime //uninstall onnxruntime
pip install rembg[gpu] onnxruntime-gpu //install rembg with GPU support

Thanks~~

@tomgwasira
Copy link

My comment is not necessarily to do with rembg, but this error can also be caused when your ONNXRuntime version does not support your TensorRT version.

@Royrychou
Copy link

对我有用:

pip uninstall rembg //uninstall rembg
pip uninstall onnxruntime //uninstall onnxruntime
pip install rembg[gpu] onnxruntime-gpu //install rembg with GPU support

it works but...with out onxxruntime other nodes would be error

@xam0482
Copy link

xam0482 commented Aug 3, 2024

应该是 onnxruntime onnxruntime-gpu 两个版本不一致造成的 , 更新成相同的版本

@listmaster21
Copy link

pip uninstall rembg //uninstall rembg
pip uninstall onnxruntime //uninstall onnxruntime
pip install rembg[gpu] onnxruntime-gpu //install rembg with GPU support

its work for me 2 :) thanx a lot :)

@lzluuu
Copy link

lzluuu commented Aug 22, 2024

It worked when I changed ONNX Runtime-gpu version to 1.17.1 (My cuda version is 12.1), even Runtime-gpu 1.18.1 doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests