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

[Build] CUDA_PATH is set but CUDA wasn't able to be loaded (Windows 11, onnxruntime-gpu 1.13.1, CUDA 11.8) #21740

Closed
Ltbltbltbltb opened this issue Aug 14, 2024 · 2 comments
Labels
build build issues; typically submitted using template ep:CUDA issues related to the CUDA execution provider platform:windows issues related to the Windows platform

Comments

@Ltbltbltbltb
Copy link

Describe the issue

I am trying to use the ONNX Runtime CUDA Execution Provider with a GeForce RTX 4060 Ti on Windows 11, but I am consistently getting the error "CUDA_PATH is set but CUDA wasn't able to be loaded". I have CUDA Toolkit 11.8 and cuDNN 8.9.2 installed, and I am using onnxruntime-gpu version 1.13.1.

I have tried the following troubleshooting steps:

  • Reinstalling CUDA Toolkit 11.8 and cuDNN 8.9.2
  • Reinstalling onnxruntime-gpu 1.13.1 with the --no-cache-dir flag
  • Verifying that the CUDA_PATH, Path, INCLUDE, and LIB environment variables are set correctly
  • Running the deviceQuery.exe and bandwidthTest.exe CUDA samples, which both passed
  • Running the script and the Deep-Live-Cam application as administrator
  • Disabling my antivirus temporarily
  • Creating an onnxruntime_config.json file to force the use of the CUDA Execution Provider
  • Checking NVIDIA Control Panel settings to ensure that my GPU is selected for CUDA

Despite these efforts, the error persists. I am unable to generate the ONNX Runtime debug log. I am using Python 3.10.9 and Visual Studio Build Tools 2022.

I have attached the output of the onnx_test.py script and the Deep-Live-Cam application, as well as screenshots of my environment variables.

I would greatly appreciate any assistance in resolving this issue.

Urgency

No response

Target platform

Windows

Build script

import onnxruntime as ort
import json

with open('onnxruntime_config.json', 'r') as f:
config = json.load(f)

try:
ort_session = ort.InferenceSession(r"C:\Users\lucas\miniconda3\envs\trocarosto\Deep-Live-Cam\models\inswapper_128_fp16.onnx", providers=config['providers'])
print("Sessão ONNX Runtime com CUDA criada com sucesso!")
except Exception as e:
print(f"Erro ao criar sessão ONNX Runtime com CUDA: {e}")

image

image

image

Error / output

(base) C:\Windows\System32>conda activate trocarosto

(trocarosto) C:\Windows\System32>cd C:\Users\lucas\miniconda3\envs\trocarosto\Deep-Live-Cam

(trocarosto) C:\Users\lucas\miniconda3\envs\trocarosto\Deep-Live-Cam>python onnx_test.py
EP Error using [{'name': 'CUDAExecutionProvider', 'device_id': 0}]
Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.
2 0 2 4 - 0 8 - 1 4 1 5 : 2 9 : 4 5 . 0 7 5 7 7 1 7 [ W : o n n x r u n t i m e : , g r a p h . c c : 3 4 8 7 o n n x r u n t i m e : : G r a p h : : C l e a n U n u s e d I n i t i a l i z e r s A n d N o d e A r g s ] R e m o v i n g i n i t i a l i z e r ' b u f f 2 f s ' . I t i s n o t u s e d b y a n y n o d e a n d s h o u l d b e r e m o v e d f r o m t h e m o d e l .
2 0 2 4 - 0 8 - 1 4 1 5 : 2 9 : 4 5 . 1 0 9 4 0 4 5 [ E : o n n x r u n t i m e : D e f a u l t , p r o v i d e r _ b r i d g e _ o r t . c c : 1 2 6 6 o n n x r u n t i m e : : T r y G e t P r o v i d e r I n f o _ C U D A ] D : \ a \ _ w o r k \ 1 \ s \ o n n x r u n t i m e \ c o r e \ s e s s i o n \ p r o v i d e r _ b r i d g e _ o r t . c c : 1 0 6 9 o n n x r u n t i m e : : P r o v i d e r L i b r a r y : : G e t [ O N N X R u n t i m e E r r o r ] : 1 : F A I L : L o a d L i b r a r y f a i l e d w i t h e r r o r 1 2 6 " " w h e n t r y i n g t o l o a d " C : \ U s e r s \ l u c a s \ m i n i c o n d a 3 \ e n v s \ t r o c a r o s t o \ L i b \ s i t e - p a c k a g e s \ o n n x r u n t i m e \ c a p i \ o n n x r u n t i m e _ p r o v i d e r s _ c u d a . d l l "

Erro ao criar sessão ONNX Runtime com CUDA: D:\a_work\1\s\onnxruntime\python\onnxruntime_pybind_state.cc:574 onnxruntime::python::CreateExecutionProviderInstance CUDA_PATH is set but CUDA wasn't able to be loaded. Please install the correct version of CUDA and cuDNN as mentioned in the GPU requirements page (https://onnxruntime.ai/docs/reference/execution-providers/CUDA-ExecutionProvider.html#requirements), make sure they're in the PATH, and that your GPU is supported.

(trocarosto) C:\Users\lucas\miniconda3\envs\trocarosto\Deep-Live-Cam>

Visual Studio Version

Visual Studio Build Tools 2022

GCC / Compiler Version

No response

@Ltbltbltbltb Ltbltbltbltb added the build build issues; typically submitted using template label Aug 14, 2024
@github-actions github-actions bot added ep:CUDA issues related to the CUDA execution provider platform:windows issues related to the Windows platform labels Aug 14, 2024
@tianleiwu
Copy link
Contributor

tianleiwu commented Aug 15, 2024

You will need set PATH environment variable to directories containing cuda, cudnn and VC Runtime DLLs.
Example is like
set PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\libnvvp;C:\nvidia\cudnn-windows-x86_64-8.9.6.50_cuda11-archive\bin;C:\Windows\system32

@Ltbltbltbltb
Copy link
Author

Thank you very much my Man! You're a Genius!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template ep:CUDA issues related to the CUDA execution provider platform:windows issues related to the Windows platform
Projects
None yet
Development

No branches or pull requests

2 participants