rembg icon indicating copy to clipboard operation
rembg copied to clipboard

[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"

Open chelsea456 opened this issue 2 years ago • 7 comments

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 avatar Oct 09 '22 16:10 chelsea456

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

dandumit avatar Oct 14 '22 03:10 dandumit

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

chelsea456 avatar Oct 14 '22 04:10 chelsea456

I also have the same issue on windows 11.

togaiaoi avatar Oct 15 '22 12:10 togaiaoi

The same issue on Win10

noDGodiaev avatar Oct 16 '22 12:10 noDGodiaev

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

Andebugulin avatar Oct 16 '22 20:10 Andebugulin

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)).

Jangsoodlor avatar Oct 24 '22 04:10 Jangsoodlor

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

disconnect00 avatar Nov 02 '22 09:11 disconnect00

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

baimoda avatar Nov 26 '22 12:11 baimoda

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

baimoda avatar Nov 26 '22 12:11 baimoda

I also have same issue.

NeoNeetPro avatar Dec 08 '22 16:12 NeoNeetPro

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.

hansnolte avatar Dec 22 '22 10:12 hansnolte

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.

oldoty-moco avatar Dec 23 '22 05:12 oldoty-moco

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

gopfranco avatar Dec 30 '22 01:12 gopfranco

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

TinyGiraffeCpp avatar Jan 02 '23 12:01 TinyGiraffeCpp

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

JimGaleForce avatar Jan 13 '23 09:01 JimGaleForce

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

github-actions[bot] avatar Feb 13 '23 02:02 github-actions[bot]

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

github-actions[bot] avatar Feb 27 '23 02:02 github-actions[bot]

same issue here.

treksis avatar Mar 10 '23 18:03 treksis

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:

  • https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html
  • NOTE: Requires a specific version of cuDNN (currently cuDNN 8.6.0)
  • Then download TensorRT library from https://developer.nvidia.com/tensorrt
  • Make sure to add the lib folder to path.

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!

glmcdona avatar Mar 12 '23 22:03 glmcdona

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.

judy avatar Mar 15 '23 13:03 judy

I solved with

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

I got some warning stuffs but it works

image

treksis avatar Mar 18 '23 18:03 treksis

Works for me:

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

sanyuzhang avatar Mar 30 '23 23:03 sanyuzhang

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

UnsleepingCat avatar May 18 '23 15:05 UnsleepingCat

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

Zyin055 avatar Jun 08 '23 16:06 Zyin055

对我有用:

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

FoliAGEQBS avatar Jun 23 '23 06:06 FoliAGEQBS

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

youuoypi avatar Jul 30 '23 13:07 youuoypi

Works for me.win 11

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

找到里面的python.exe后

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

image

duoduo369 avatar Dec 14 '23 13:12 duoduo369

Works for me.win 11

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

找到里面的python.exe后

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

image

在执行install解决问题

Jasson avatar Jan 02 '24 00:01 Jasson

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

nightwalker89 avatar Jan 23 '24 16:01 nightwalker89

Works for me.win 11

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

找到里面的python.exe后

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

image

thanks!

shynesss avatar Feb 01 '24 08:02 shynesss