TensorFlow
libcudart.so.10.0
Ubuntu 18.04
CUDA
troubleshooting

Tensorflow Could not load dynamic library 'libcudart.so.10.0 on ubuntu 18.04

ML System Design practice on Codemia

Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.

Practice ML system design

Introduction

The error about missing libcudart.so.10.0 usually means TensorFlow expects a CUDA runtime version that is not installed or not visible in library paths. This is an environment compatibility issue, not a model-code bug. The fix is to align TensorFlow, CUDA, CuDNN, and system library configuration.

Verify Installed Versions First

Start by checking your TensorFlow build and GPU visibility.

bash
1python3 - <<'PYTHON_CHECK'
2import tensorflow as tf
3print("tf version:", tf.__version__)
4print("gpus:", tf.config.list_physical_devices('GPU'))
5PYTHON_CHECK

Then inspect CUDA runtime libraries on the machine.

bash
ls /usr/local | rg cuda
ldconfig -p | rg libcudart
nvidia-smi

These commands quickly reveal whether required runtime files are present.

Align TensorFlow with Supported CUDA Stack

If TensorFlow build expects CUDA 10.0, installing only CUDA 11 or 12 will not satisfy that requirement. Use a TensorFlow version that matches your installed toolkit, or install the toolkit version expected by your TensorFlow package.

In many cases, the fastest path is creating a fresh environment with known-compatible versions.

bash
1python3 -m venv .venv
2source .venv/bin/activate
3pip install --upgrade pip
4pip install tensorflow==2.4.4

Adjust TensorFlow version based on your driver and CUDA plan.

Set Library Paths Correctly

Even with installed libraries, runtime may fail if LD_LIBRARY_PATH does not include CUDA directories.

bash
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda/bin:$PATH
python3 -c "import tensorflow as tf; print(tf.__version__)"

Persist these settings in shell startup files if needed for your workflow.

Container Strategy for Reproducibility

Containerized environments reduce dependency drift between machines.

bash
docker run --rm --gpus all -it tensorflow/tensorflow:2.13.0-gpu python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

Using a tested image can eliminate manual CUDA and CuDNN alignment work.

Structured Troubleshooting Checklist

When the error persists, verify symbolic links, package manager leftovers, and mixed CUDA installations. Remove stale environment variables that point to old toolkits. Reboot after driver changes so runtime linkage is refreshed.

A structured checklist usually resolves the issue faster than random package reinstall attempts.

Validate Runtime with a Minimal GPU Operation

Before loading a large model, run one simple GPU computation to confirm runtime health.

python
1import tensorflow as tf
2
3with tf.device('/GPU:0'):
4    a = tf.random.normal([1024, 1024])
5    b = tf.random.normal([1024, 1024])
6    c = tf.matmul(a, b)
7
8print(c.shape)

If this fails, continue environment debugging before touching training code.

Clean Up Conflicting CUDA Installations

Machines with multiple old CUDA folders often resolve the wrong runtime first. Remove unused toolkit paths and keep one active version in shell configuration.

bash
1# Example cleanup workflow
2ls -la /usr/local | rg cuda
3# remove stale symlinks only after verifying usage
4# sudo rm /usr/local/cuda-old-link

After cleanup, reopen the shell and rerun library checks to confirm libcudart resolution points to the intended toolkit.

Keep Environment Snapshots for Future Debugging

Once the runtime works, capture package and driver metadata for future incident response.

bash
pip freeze > requirements-gpu.txt
nvidia-smi > nvidia-smi.txt

These snapshots make future upgrades safer and shorten recovery time when dependency drift reappears.

Common Pitfalls

  • Installing a TensorFlow build that expects a different CUDA runtime version.
  • Forgetting to update LD_LIBRARY_PATH after toolkit changes.
  • Mixing system package CUDA with manual toolkit installs.
  • Debugging model code before confirming basic GPU runtime health.

Summary

  • Missing libcudart.so.10.0 indicates runtime version mismatch or path issues.
  • Verify TensorFlow and CUDA compatibility before changing code.
  • Configure library paths so runtime can resolve CUDA shared objects.
  • Use containers or clean virtual environments for reproducible GPU setups.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

ML System Design practice on Codemia

Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.

Practice ML system design

All Rights Reserved.