How to install libcudart11.0

I installed tensorflow-gpu v2.9.0 using pip on Ubuntu 20.04. But I get this error when importing tensorflow: “Could not load dynamic library ‘’; dlerror: cannot open shared object file: No such file or directory”

How can I install libcudart v11.0? I was not able to install it using sudo apt-get install libcudart11.0 although I have installed previous versions (libcudart10.2) of it using apt-get. I also tried “sudo apt-get install cuda-cudart-11-0” but the package could not be located.


Welcome to the Tensorflow Forum,

You can install CUDA 11.0 as shown below

sudo mv /etc/apt/preferences.d/cuda-repository-pin-600
sudo dpkg -i cuda-repo-ubuntu2004-11-0-local_11.0.2-450.51.05-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-0-local/
sudo apt-get update
sudo apt-get -y install cuda

Thank you!

@chunduriv Thanks for your reply.

The installation (sudo apt-get -y install cuda) failed.

Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

import tensorflow as tf
2023-07-04 15:07:23.376576: E tensorflow/stream_executor/cuda/] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
2023-07-04 15:07:23.376653: I tensorflow/stream_executor/cuda/] libcuda reported version is: 450.51.5
2023-07-04 15:07:23.376671: I tensorflow/stream_executor/cuda/] kernel reported version is: 525.116.4
2023-07-04 15:07:23.376676: E tensorflow/stream_executor/cuda/] kernel version 525.116.4 does not match DSO version 450.51.5 – cannot find working devices in this configuration


Can you try following command and let us know?

sudo apt-get install

Thank you!

sudo apt-get install
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package
E: Couldn’t find any package by glob ‘’
E: Couldn’t find any package by regex ‘’


Verify the CUDA repository: If you’re using NVIDIA’s CUDA, make sure the CUDA repository is listed among your package sources. The official NVIDIA documentation includes steps for adding the CUDA repository.

Also, ensure to update your package lists

sudo apt-get update

I hope that helps

@Ibrahimgoke Could you share more specific instructions on how to do this for the benefit of everyone? Thanks


Previously there were similar scenarios which is more similar to your usecase and that proved successful.

You will need to remove all Nvidia repository references and purge all the packages they installed. The easiest way to do this is usually to do a full re-installation of Ubuntu.

After you have fully removed the Nvidia packages, re-install the nvidia driver along with nvidia-cuda-toolkit and nvidia-cudnn apt packages from the official Ubuntu repositories.

Thank you!

In case anybody else is having the same issue, I installed CUDA11.2 using conda in a conda environment (avoid installing CUDA system wide for tensorflow).

conda install -c conda-forge cudatoolkit=11.2.2 cudnn=8.1.0

After this, I still encountered the ‘’ missing error from tensorflow. Assuming CUDA was installed properly, the location of libcudart must be added to LD_LIBRARY_PATH. See below.

# first identify the location of in your system
sudo find / -name '' # this will return the location
# then add the location to LD_LIBRARY_PATH (below was the location on my system, replace with your own)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/miniconda3/envs/cuda-env/lib

@chunduriv thanks for your help!