jax-ml/jax · error · std::runtime_error
cuDNN not found.
Error message
cuDNN not found.
What it means
jaxlib queries cuDNN's version at runtime via cudnnGetVersion(); a 0 return means TSL's stub loader could not locate or load libcudnn, so a dummy stub answered. jaxlib refuses to report a bogus version and raises instead.
Source
Thrown at jaxlib/cuda/versions_helpers.cc:98
int CusparseGetVersion() {
// cusparseGetVersion is unhappy if passed a null library handle. But
// cusparseGetProperty doesn't require one.
int major, minor, patch;
JAX_THROW_IF_ERROR(JAX_AS_STATUS(cusparseGetProperty(MAJOR_VERSION, &major)));
JAX_THROW_IF_ERROR(JAX_AS_STATUS(cusparseGetProperty(MINOR_VERSION, &minor)));
JAX_THROW_IF_ERROR(JAX_AS_STATUS(cusparseGetProperty(PATCH_LEVEL, &patch)));
ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(&major, sizeof major);
ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(&minor, sizeof minor);
ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(&patch, sizeof patch);
return major * 1000 + minor * 100 + patch;
}
size_t CudnnGetVersion() {
size_t version = ::cudnnGetVersion();
// If the cudnn stub in TSL can't find the library, it will use a dummy stub
// that returns 0, since cudnnGetVersion() cannot fail.
if (version == 0) {
throw std::runtime_error("cuDNN not found.");
}
ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(&version, sizeof version);
return version;
}
int CudaComputeCapability(int device) {
int major, minor;
{
absl::MutexLock lock(driver_initialization_mutex);
if (!driver_initialized) {
JAX_THROW_IF_ERROR(JAX_AS_STATUS(cuInit(0)));
driver_initialized = true;
}
}
JAX_THROW_IF_ERROR(JAX_AS_STATUS(gpuDeviceGetAttribute(
&major, GPU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, device)));
JAX_THROW_IF_ERROR(JAX_AS_STATUS(gpuDeviceGetAttribute(
&minor, GPU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, device)));
ABSL_ANNOTATE_MEMORY_IS_INITIALIZED(&major, sizeof major);View on GitHub (pinned to 1e1c6a8fc0)
Solutions
- pip install -U nvidia-cudnn-cu12 matching your jaxlib CUDA version
- Set LD_LIBRARY_PATH to the directory containing libcudnn.so (e.g. the pip nvidia/cudnn/lib dir)
- Verify with python -c "import ctypes; ctypes.CDLL('libcudnn.so')" and fix loader errors
- Ensure cuDNN major version matches the one your jaxlib wheel was built against
Example fix
# before: pip install jax # after: pip install -U "jax[cuda12]"
Defensive patterns
Strategy: validation
Validate before calling
import ctypes
try:
ctypes.CDLL('libcudnn.so')
ok = True
except OSError as e:
ok = False; print(e) Prevention
- Install jax via extras: pip install 'jax[cuda12]'
- Verify nvidia-cudnn-cu12 version matches jaxlib requirements before running
- Set LD_LIBRARY_PATH to the pip nvidia lib dirs
When it happens
Trigger: Importing/initializing jax CUDA support when LD_LIBRARY_PATH/PIP cuDNN does not contain a loadable libcudnn (e.g. nvidia-cudnn-cu12 wheel missing or wrong major version for your CUDA).
Common situations: pip-installing jax without the matching nvidia-cudnn-cu12 package; custom CUDA envs where cuDNN is not on the loader path; upgrading jaxlib but not the CUDA extras wheels.
Related errors
- Nonsymmetric eigendecomposition requires cusolver 11.7.1 or
- cuDNN doesn't support right window: {r_window} when causal m
- bfloat16 support not implemented for LSTM
- Unknown GPU platform for __dlpack__: {platform_version}
- Couldn't get local_hardware_id for __dlpack__
AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27).
Data as JSON: /api/errors/a3c68f2d219faf7d.
Report an issue: GitHub.