RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED
ID: cuda/cudnn-not-compiled
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 12 | active | — | — | — |
| 12 | active | — | — | — |
Root Cause
cuDNN library fails to initialize, typically due to a version mismatch between the installed cuDNN, CUDA toolkit, and the deep learning framework. Can also occur when cuDNN shared libraries are missing or LD_LIBRARY_PATH is misconfigured.
genericWorkarounds
-
93% success Install PyTorch from the official channel with the correct CUDA version, which bundles a compatible cuDNN
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 # This bundles cuDNN matching CUDA 12.1; verify with: python -c "import torch; print(torch.backends.cudnn.version())"
-
90% success Use NVIDIA's official CUDA container images that have pre-matched CUDA, cuDNN, and NCCL versions
docker run --gpus all -it nvcr.io/nvidia/pytorch:24.01-py3 # NGC containers include tested combinations of CUDA, cuDNN, and PyTorch
Sources: https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch
-
88% success Install the matching cuDNN version using conda which handles dependency resolution automatically
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia # conda resolves cuDNN version automatically
Dead Ends
Common approaches that don't work:
-
Set torch.backends.cudnn.enabled = False to bypass cuDNN entirely
65% fail
Disables hardware-accelerated convolution and RNN operations, causing 2-10x slowdown; treats the symptom rather than fixing the version mismatch
-
Download and install cuDNN from the NVIDIA website without checking CUDA version compatibility
60% fail
cuDNN 8.x requires specific CUDA minor versions; installing cuDNN 8.9 with CUDA 12.0 may fail because cuDNN 8.9 requires CUDA 12.2+
-
Upgrade only the CUDA toolkit without updating cuDNN or the framework
75% fail
Upgrading CUDA without matching cuDNN and PyTorch versions creates a three-way version incompatibility that is harder to debug