ONNX Runtime imports, but GPU execution fails: check providers and sessions
Separate package discovery, runtime providers and the session that actually executes your model.
Use three checkpoints
The onnx package, an ONNX Runtime distribution, and a running inference session are different things. The upstream installation and CUDA-provider documentation specify their requirements; the API exposes both available providers and session providers.123
python -m pip show onnx onnxruntime onnxruntime-gpu
python -c "import onnxruntime as r; print(r.__version__); print(r.get_available_providers())"
Run this only with the intended interpreter and a trusted installation. The second command imports native code. An available-provider list does not prove your model executed on that device.
Route the failure
No import: investigate environment selection and installation. Provider-library failure: compare the exact CUDA/cuDNN requirements. CPU fallback: inspect the node's session configuration and initialization log. Model-format or operator failure: preserve that error rather than treating it as a driver problem.
Our proposed acceptance check is one small run through the original node, with its actual session provider recorded. Test changes in a copy where practical. A successful CPU run should be reported as a CPU result, not as verified GPU acceleration. This article deliberately avoids a single version pin for every platform.
Related checks
- Fix cv2 imports without stacking OpenCV distributions
- Keep a reproducible ComfyUI repair record without exposing secrets
Research draft. No local/GPU reproduction or independent editorial sign-off. Upstream statements and our recommendations are distinguished.
Was this page helpful?
Anonymous. Only a yes/no counter is stored; no account, IP address or device details.
Sources & references
Research draft. No local/GPU reproduction or independent editorial sign-off. Upstream statements and our recommendations are distinguished.
01ONNX Runtime installationSource checked: 2026-09-2102ONNX Runtime CUDA execution providerSource checked: 2026-09-2103ONNX Runtime Python APISource checked: 2026-09-21