AUTOMATIC1111 / stable-diffusion-webui-rembg

Removes backgrounds from pictures. Extension for webui.
MIT License
1.15k stars 171 forks source link

Tensor.dll error #5

Open amiremami opened 1 year ago

amiremami commented 1 year ago

I got this error:

Error completing request Arguments: (0, <PIL.Image.Image image mode=RGB size=720x480 at 0x1E6DB78EF50>, None, '', '', True, 0, 2, 512, 512, True, 'None', 'None', 0, 0, 0, 0, 'u2net_human_seg', False, False, 240, 10, 10) {} Traceback (most recent call last): File "C:\Users\Amir\stable-diffusion-webui\modules\call_queue.py", line 56, in f res = list(func(*args, *kwargs)) File "C:\Users\Amir\stable-diffusion-webui\modules\call_queue.py", line 37, in f res = func(args, kwargs) File "C:\Users\Amir\stable-diffusion-webui\modules\postprocessing.py", line 56, in run_postprocessing scripts.scripts_postproc.run(pp, args) File "C:\Users\Amir\stable-diffusion-webui\modules\scripts_postprocessing.py", line 130, in run script.process(pp, process_args) File "C:\Users\Amir\stable-diffusion-webui\extensions\stable-diffusion-webui-rembg\scripts\postprocessing_rembg.py", line 53, in process session=rembg.new_session(model), File "C:\Users\Amir\stable-diffusion-webui\venv\lib\site-packages\rembg\session_factory.py", line 66, in new_session ort.InferenceSession( File "C:\Users\Amir\stable-diffusion-webui\venv\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 360, in init self._create_inference_session(providers, provider_options, disabled_optimizers) File "C:\Users\Amir\stable-diffusion-webui\venv\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 408, in _create_inference_session sess.initialize_session(providers, provider_options, disabled_optimizers) RuntimeError: D:\a_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1106 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\Amir\stable-diffusion-webui\venv\lib\site-packages\onnxruntime\capi\onnxruntime_providers_tensorrt.dll"

VRArt1 commented 1 year ago

I'm also getting this error.

tenabraex commented 1 year ago

yup i've got the same error (win10, 2080ti) updated my a1111, restarted a couple times

jordanjay29 commented 1 year ago

Confirmed. I tried rebuilding the venv folder and ran into the same issue as this. Win 11, 3060.

treksis commented 1 year ago

same here

yuzehong1986 commented 1 year ago

same here

Lait999 commented 1 year ago

run pip install onnxruntime --upgrade onnxruntime==1.14 on my venv worked for me. Good luck

tenabraex commented 1 year ago

_> run pip install onnxruntime --upgrade onnxruntime==1.14 on my venv worked for me. Good luck

didn't work for me sadly ... updated with an error (something about a pip conflict because remBG wanted 1.13) but running it again confirms it did remove 1.13 and install 1.14.

as it has always been, the file it is looking for is where it's looking for it. "D:\Github\stable-diffusion-webui\venv\lib\site-packages\onnxruntime\capi\onnxruntime_providers_tensorrt.dl"

RuntimeError: D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1069 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "D:\Github\stable-diffusion-webui\venv\lib\site-packages\onnxruntime\capi\onnxruntime_providers_tensorrt.dll"_

ah ignore all that i had to

stable-diffusion-webui\venv\Scripts> activate.ps1

first to activate the venv for a1111 first THEN run the command.

such simple things, but you have to know them to do them.

askmenow commented 1 year ago

Confirmed. I tried rebuilding the venv folder and ran into the same issue as this. Win 11, 3060.

remove and rebuild venv, it works for me

atomjke commented 1 year ago

_> run pip install onnxruntime --upgrade onnxruntime==1.14 on my venv worked for me. Good luck

didn't work for me sadly ... updated with an error (something about a pip conflict because remBG wanted 1.13) but running it again confirms it did remove 1.13 and install 1.14.

as it has always been, the file it is looking for is where it's looking for it. "D:\Github\stable-diffusion-webui\venv\lib\site-packages\onnxruntime\capi\onnxruntime_providers_tensorrt.dl"

RuntimeError: D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1069 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "D:\Github\stable-diffusion-webui\venv\lib\site-packages\onnxruntime\capi\onnxruntime_providers_tensorrt.dll"_

ah ignore all that i had to

stable-diffusion-webui\venv\Scripts> activate.ps1

first to activate the venv for a1111 first THEN run the command.

such simple things, but you have to know them to do them.

this one worked for me, big thx. for those who need more details (steps):

1) go to \WebUI\venv\Scripts 2) run activate.bat 3) create .bat file in same directory and put there this command: pip install onnxruntime --upgrade onnxruntime==1.14 or run cmd in scripts folders and use same command 4) enjoy

amiremami commented 1 year ago

_> run pip install onnxruntime --upgrade onnxruntime==1.14 on my venv worked for me. Good luck didn't work for me sadly ... updated with an error (something about a pip conflict because remBG wanted 1.13) but running it again confirms it did remove 1.13 and install 1.14. as it has always been, the file it is looking for is where it's looking for it. "D:\Github\stable-diffusion-webui\venv\lib\site-packages\onnxruntime\capi\onnxruntime_providers_tensorrt.dl" RuntimeError: D:\a\_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1069 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "D:\Github\stable-diffusion-webui\venv\lib\site-packages\onnxruntime\capi\onnxruntime_providers_tensorrt.dll"_ ah ignore all that i had to stable-diffusion-webui\venv\Scripts> activate.ps1 first to activate the venv for a1111 first THEN run the command. such simple things, but you have to know them to do them.

this one worked for me, big thx. for those who need more details (steps):

  1. go to \WebUI\venv\Scripts
  2. run activate.bat
  3. create .bat file in same directory and put there this command: pip install onnxruntime --upgrade onnxruntime==1.14 or run cmd in scripts folders and use same command
  4. enjoy

Unfortunately this didn't work for me and I still get the error.

Miraihi commented 1 year ago

Was able to fix it, thanks to the replies. Instruction step-by-step:

  1. Open cmd
  2. cd /d (path to webui)\venv\Scripts\
  3. activate.bat
  4. python -m pip install -U pip
  5. pip install onnxruntime --upgrade onnxruntime==1.14
amiremami commented 1 year ago

Was able to fix it, thanks to the replies. Instruction step-by-step:

  1. Open cmd
  2. cd /d (path to webui)\venv\Scripts\
  3. activate.bat
  4. python -m pip install -U pip
  5. pip install onnxruntime --upgrade onnxruntime==1.14

Thanks, but still didn't work for me, do you have any idea?

Microsoft Windows [Version 10.0.19045.2728]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Amir\stable-diffusion-webui\venv\Scripts>activate

(venv) C:\Users\Amir\stable-diffusion-webui\venv\Scripts>python -m pip install -U pip
WARNING: Ignoring invalid distribution -rotobuf (c:\users\amir\stable-diffusion-webui\venv\lib\site-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:\users\amir\stable-diffusion-webui\venv\lib\site-packages)
Requirement already satisfied: pip in c:\users\amir\stable-diffusion-webui\venv\lib\site-packages (23.0.1)
WARNING: Ignoring invalid distribution -rotobuf (c:\users\amir\stable-diffusion-webui\venv\lib\site-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:\users\amir\stable-diffusion-webui\venv\lib\site-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:\users\amir\stable-diffusion-webui\venv\lib\site-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:\users\amir\stable-diffusion-webui\venv\lib\site-packages)

(venv) C:\Users\Amir\stable-diffusion-webui\venv\Scripts>pip install onnxruntime --upgrade onnxruntime==1.14
WARNING: Ignoring invalid distribution -rotobuf (c:\users\amir\stable-diffusion-webui\venv\lib\site-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:\users\amir\stable-diffusion-webui\venv\lib\site-packages)
Collecting onnxruntime
  Using cached onnxruntime-1.14.1-cp310-cp310-win_amd64.whl (6.5 MB)
  Using cached onnxruntime-1.14.0-cp310-cp310-win_amd64.whl (6.5 MB)
Requirement already satisfied: packaging in c:\users\amir\stable-diffusion-webui\venv\lib\site-packages (from onnxruntime) (23.0)
Requirement already satisfied: coloredlogs in c:\users\amir\stable-diffusion-webui\venv\lib\site-packages (from onnxruntime) (15.0.1)
Requirement already satisfied: protobuf in c:\users\amir\stable-diffusion-webui\venv\lib\site-packages (from onnxruntime) (3.19.6)
Requirement already satisfied: flatbuffers in c:\users\amir\stable-diffusion-webui\venv\lib\site-packages (from onnxruntime) (23.1.21)
Requirement already satisfied: sympy in c:\users\amir\stable-diffusion-webui\venv\lib\site-packages (from onnxruntime) (1.11.1)
Requirement already satisfied: numpy>=1.21.6 in c:\users\amir\stable-diffusion-webui\venv\lib\site-packages (from onnxruntime) (1.23.3)
Requirement already satisfied: humanfriendly>=9.1 in c:\users\amir\stable-diffusion-webui\venv\lib\site-packages (from coloredlogs->onnxruntime) (10.0)
Requirement already satisfied: mpmath>=0.19 in c:\users\amir\stable-diffusion-webui\venv\lib\site-packages (from sympy->onnxruntime) (1.2.1)
Requirement already satisfied: pyreadline3 in c:\users\amir\stable-diffusion-webui\venv\lib\site-packages (from humanfriendly>=9.1->coloredlogs->onnxruntime) (3.4.1)
WARNING: Ignoring invalid distribution -rotobuf (c:\users\amir\stable-diffusion-webui\venv\lib\site-packages)
Installing collected packages: onnxruntime
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Users\\Amir\\stable-diffusion-webui\\venv\\Lib\\site-packages\\onnxruntime\\capi\\onnxruntime_providers_shared.dll'
Check the permissions.

WARNING: Ignoring invalid distribution -rotobuf (c:\users\amir\stable-diffusion-webui\venv\lib\site-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:\users\amir\stable-diffusion-webui\venv\lib\site-packages)
WARNING: Ignoring invalid distribution -rotobuf (c:\users\amir\stable-diffusion-webui\venv\lib\site-packages)

(venv) C:\Users\Amir\stable-diffusion-webui\venv\Scripts>
Miraihi commented 1 year ago

A problem with permissions. If you're running Stable diffusion then close it.

amiremami commented 1 year ago

A problem with permissions. If you're running Stable diffusion then close it.

Thank you so much my friend, finally worked 🙏

2blackbar commented 1 year ago

add it to dependencies on install so the bug wont happen

VRArt1 commented 10 months ago

I'd like to confirm that deleting the venv folder and letting it rebuild fixed the error for me.