danielgatis / rembg

Rembg is a tool to remove images background
MIT License
16.71k stars 1.86k forks source link

[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 closed 1 year ago

chelsea456 commented 2 years ago

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"

dandumit commented 2 years ago

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

chelsea456 commented 2 years ago

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 commented 2 years ago

I also have the same issue on windows 11.

noDGodiaev commented 2 years ago

The same issue on Win10

Andebugulin commented 2 years ago

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

Jangsoodlor commented 2 years ago

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 commented 1 year ago

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 commented 1 year ago

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

baimoda commented 1 year ago

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

NeoNeetPro commented 1 year ago

I also have same issue.

hansnolte commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

TinyGiraffeCpp commented 1 year ago

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

JimGaleForce commented 1 year ago

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[bot] commented 1 year ago

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

github-actions[bot] commented 1 year ago

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

treksis commented 1 year ago

same issue here.

glmcdona commented 1 year ago

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:

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 commented 1 year ago

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 commented 1 year ago

I solved with

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

I got some warning stuffs but it works

image
sanyuzhang commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

对我有用:

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 commented 1 year ago

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

duoduo369 commented 10 months ago

Works for me.win 11

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

找到里面的python.exe后

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

image

Jasson commented 9 months ago

Works for me.win 11

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

找到里面的python.exe后

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

image

在执行install解决问题

nightwalker89 commented 9 months ago

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 commented 8 months ago

Works for me.win 11

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

找到里面的python.exe后

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

image

thanks!

7kms commented 7 months ago

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 commented 7 months ago

Works for me.win 11

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

找到里面的python.exe后

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

image

THANKS

tkz24589 commented 5 months ago

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 commented 5 months ago

是package的问题,重新安装onnxrunti

U are right.

hushanhsiang commented 4 months ago

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 commented 2 months ago

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 commented 2 months ago

对我有用:

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 commented 2 months ago

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

listmaster21 commented 2 months ago

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 commented 2 months ago

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