InterviewsVector

Fix: Could not load dynamic library 'libcudart.so.11.0'

Quick answer

TensorFlow was built against CUDA 11 and cannot find its runtime, libcudart.so.11.0. The trailing 11.0 is a major-version SONAME: any CUDA 11.x toolkit provides it (with an NVIDIA driver >= 450), but CUDA 12 ships libcudart.so.12 and will not satisfy it. Run `ldconfig -p | grep libcudart` — if it's listed, add its lib64 directory to LD_LIBRARY_PATH; if not, install a CUDA 11.x runtime, or install a TensorFlow build compiled for the CUDA you have.

Short answer: TensorFlow was built against CUDA 11 and can't find its runtime, libcudart.so.11.0. The trailing 11.0 is a major-version SONAME — any CUDA 11.x toolkit provides it (with driver ≥ 450), but CUDA 12 ships libcudart.so.12 and will not satisfy it. Run ldconfig -p | grep libcudart: if it's listed, add its lib64 dir to LD_LIBRARY_PATH; if not, install a CUDA 11.x runtime — or install a TensorFlow build compiled for the CUDA you actually have.

Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file means TensorFlow went looking for the CUDA runtime it was built against and the dynamic loader couldn't find it. libcudart is the CUDA Runtime library, and the 11.0 tells you exactly which one it needs.

What "11.0" really requires

The 11.0 is a SONAME — a version tag the binary links against. Two facts make it manageable:

  • It's a major-version tag. From CUDA 11 onward, NVIDIA guarantees minor-version compatibility, so every CUDA 11.x release ships the same libcudart.so.11.0. You do not need exactly 11.0 — 11.2, 11.6, 11.8 all provide it, as long as your NVIDIA driver is ≥ 450.
  • CUDA 12 does not count. CUDA 12.x ships libcudart.so.12, a different file. Having "CUDA installed" isn't enough if it's the wrong major version.

One more thing worth knowing: on TensorFlow this is frequently a non-fatal warning. TensorFlow logs it, disables the GPU, and continues on CPU. So first, decide whether it even hurts you:

import tensorflow as tf
print(tf.config.list_physical_devices('GPU'))

An empty list means the missing runtime cost you GPU acceleration — worth fixing. A listed GPU means you can ignore the message.

Triage in one command

ldconfig -p | grep libcudart
  • It prints a path → the runtime exists; this is a path problem. The loader just doesn't know where it is.
  • It prints nothing → the CUDA 11.x runtime isn't installed. This is a missing-runtime problem.

Confirm what you have with nvcc --version (toolkit) and nvidia-smi (driver + its CUDA ceiling).

The fixes

Path problem — expose the existing runtime:

export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH
sudo ldconfig

Missing runtime — install a matching CUDA, the easy way:

# modern TensorFlow can bring its own matched CUDA:
pip install "tensorflow[and-cuda]"
 
# or let conda resolve a compatible runtime:
conda install -c conda-forge cudatoolkit=11.8
 
# or run the official GPU image (only the host driver is needed):
docker run --gpus all -it tensorflow/tensorflow:2.14.0-gpu bash

Or move TensorFlow to your CUDA: if you're pinned to CUDA 12, install a TensorFlow build compiled for it instead of downgrading CUDA. Match either direction — the framework's expected CUDA major and the installed CUDA major must be the same.

This is one member of the CUDA shared-library-load family (libcublas, libcudnn, libcufft, libnvinfer, …) — all the same SONAME-matching problem. For the full decision tree covering every variant, see the CUDA and cuDNN library load error diagnostic guide.

Prevent it

  • Match the major version deliberately using TensorFlow's CUDA/cuDNN compatibility table before installing.
  • Prefer pip install tensorflow[and-cuda], conda, or Docker so the runtime is resolved for you.
  • Keep driver and toolkit straight: CUDA 11.x needs driver ≥ 450; the driver sets the ceiling, the toolkit provides the runtime TensorFlow links.

Decide whether it's a path or a missing-runtime problem with one ldconfig, then either expose the existing libcudart.so.11.0 or install any CUDA 11.x that provides it.

Sources

Key takeaways

  • libcudart is the CUDA runtime. This message means the CUDA 11.x runtime your TensorFlow build needs isn't on the loader's path.
  • The '11.0' is a MAJOR-version SONAME: every CUDA 11.x release provides libcudart.so.11.0, thanks to CUDA 11 minor-version compatibility.
  • CUDA 12 will NOT satisfy it — it ships libcudart.so.12. Match the major version, not the exact minor.
  • Triage with `ldconfig -p | grep libcudart`: a path means it's a PATH problem; nothing means the runtime isn't installed.
  • On TensorFlow this is often a non-fatal warning that only disables the GPU — verify with tf.config.list_physical_devices('GPU').

Frequently asked questions

Does 'could not load libcudart.so.11.0' stop TensorFlow from running?

Often it's a warning: TensorFlow falls back to CPU and keeps running, just without the GPU. Check tf.config.list_physical_devices('GPU') — an empty list means the missing runtime cost you GPU acceleration, which is worth fixing. If your program actually aborts, the runtime is genuinely required and missing.

I have CUDA 12 installed — why does it still ask for libcudart.so.11.0?

Because your TensorFlow build was compiled against CUDA 11 and links the runtime by its SONAME, libcudart.so.11.0. CUDA 12 provides libcudart.so.12, a different file the loader won't accept as a substitute. Install a CUDA 11.x runtime alongside it, or use a TensorFlow build made for CUDA 12.

Do I need exactly CUDA 11.0, or does any 11.x work?

Any CUDA 11.x works. From CUDA 11 onward, all minor releases share the libcudart.so.11.0 SONAME (minor-version compatibility), so CUDA 11.2, 11.8, etc. all satisfy the requirement — provided your NVIDIA driver is at least version 450.

What's the least error-prone way to get a matching CUDA runtime?

Let a package manager match it: `conda install -c conda-forge cudatoolkit=11.8` pulls a compatible runtime, and modern TensorFlow can be installed with its CUDA bundled via `pip install tensorflow[and-cuda]`. The official TensorFlow GPU Docker images bundle everything except the host driver. All three avoid hand-managing .so files.

By Mohammad Wasi

Software Engineering Leader & Technical Author · Updated September 9, 2026


Related Posts