Fix CUDA_ERROR_LAUNCH_FAILED & CUDNN_STATUS_INTERNAL_ERROR in TensorFlow
Quick answer
CUDA_ERROR_LAUNCH_FAILED and CUDNN_STATUS_INTERNAL_ERROR occur after the libraries load, so they are execution failures, not path problems. The most common cause is GPU memory exhaustion: TensorFlow grabs all GPU memory by default, so cuDNN can't allocate its workspace. Enable memory growth with tf.config.experimental.set_memory_growth before doing anything else. If that doesn't help, check for a cuDNN/CUDA version mismatch against your TensorFlow build, and make sure no other process is holding the GPU (nvidia-smi).
Short answer: These errors fire after the libraries load, so they're runtime failures, not path problems. The most common cause is GPU memory exhaustion — TensorFlow grabs all GPU memory by default, so cuDNN can't allocate its workspace. Enable memory growth first; if that fails, check for a cuDNN/CUDA version mismatch and make sure no other process holds the GPU.
The key diagnostic clue: CUDA_ERROR_LAUNCH_FAILED and CUDNN_STATUS_INTERNAL_ERROR appear once training starts — the libraries clearly loaded, so this is not a LD_LIBRARY_PATH/install issue. Chase runtime causes, in this order.
Cause 1 (most common): GPU memory exhaustion
By default TensorFlow reserves all GPU memory on start-up. cuDNN then has nothing left for its internal workspace and fails. Enable memory growth before creating any tensors or models:
import tensorflow as tf
gpus = tf.config.list_physical_devices("GPU")
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True) # allocate lazilyOr cap the memory explicitly:
tf.config.set_logical_device_configuration(
gpus[0],
[tf.config.LogicalDeviceConfiguration(memory_limit=4096)], # MB
)This single change resolves the majority of CUDNN_STATUS_INTERNAL_ERROR reports. If your batch is genuinely too large, also reduce the batch size.
Cause 2: cuDNN / CUDA version mismatch
If memory growth doesn't help, verify the libraries match what your TensorFlow build expects:
info = tf.sysconfig.get_build_info()
print(info["cuda_version"], info["cudnn_version"]) # what TF needsnvidia-smi # driver + max supported CUDAcuDNN must match TensorFlow's major version (equal or higher minor). A mismatch corrupts kernel launches and surfaces as CUDA_ERROR_LAUNCH_FAILED. The cleanest fix is to reinstall a matched stack — on Linux, pip install 'tensorflow[and-cuda]' bundles the correct versions (see TensorFlow not detecting GPU via conda).
Cause 3: the GPU is busy or wedged
nvidia-smi # is another process holding the GPU? is memory already full?A leftover process (a crashed notebook kernel) can hold GPU memory or leave the device in a bad state. Kill the process, restart the runtime/kernel, and re-run. If the GPU is wedged, reboot.
A diagnostic order that saves time
- Enable memory growth → re-run. (Fixes most cases.)
- Reduce batch size if it's an out-of-memory pattern.
- Check
nvidia-smifor other processes / full memory → kill/restart. - Verify cuDNN/CUDA versions against
tf.sysconfig.get_build_info(). - Reinstall a matched stack (
tensorflow[and-cuda]) only after the above.
Common mistakes
- Reinstalling CUDA first — it's a runtime error; start with memory, not paths.
- Calling
set_memory_growthtoo late — it must run before the first GPU op. - Ignoring
nvidia-smi— a zombie process is a frequent, invisible culprit.
Related GPU/CUDA fixes
- TensorFlow not detecting GPU / CUDA via conda
- Fix CUDA out of memory in PyTorch
- Fix
torch.cuda.is_available()returning False
Sources
Key takeaways
- •These errors happen AFTER load — they're runtime failures, so reinstalling paths rarely helps.
- •Most common cause: GPU memory exhaustion. Enable memory growth so cuDNN can allocate its workspace.
- •Second cause: cuDNN/CUDA version mismatch with the TensorFlow build — verify with tf.sysconfig.get_build_info().
- •Third: another process holding the GPU, or a wedged GPU — check nvidia-smi and reset the runtime.
Frequently asked questions
What causes CUDNN_STATUS_INTERNAL_ERROR in TensorFlow?
Most often GPU memory exhaustion. TensorFlow pre-allocates all GPU memory by default, leaving none for cuDNN to allocate its internal workspace, which surfaces as CUDNN_STATUS_INTERNAL_ERROR. Enabling memory growth so TensorFlow allocates lazily usually fixes it. A cuDNN/CUDA version mismatch is the next most common cause.
How do I enable GPU memory growth in TensorFlow?
Before creating any tensors or models, run: for gpu in tf.config.list_physical_devices('GPU'): tf.config.experimental.set_memory_growth(gpu, True). This makes TensorFlow allocate GPU memory incrementally instead of grabbing all of it upfront.
Why does reinstalling CUDA not fix CUDA_ERROR_LAUNCH_FAILED?
Because the error happens after the CUDA and cuDNN libraries have already loaded successfully — it's a runtime execution failure, not a missing-library problem. Reinstalling paths won't help; look at memory, version compatibility, and whether another process is using the GPU.
Software Engineering Leader & Technical Author · Updated August 26, 2026