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

Hi, I am trying to run a scrip that requires cuda, I have installed cuda 11 (which is the required version) twice but I am still getting the same error. See below

" W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘libcudart.so.11.0’; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/mujahid/.local/lib/python3.8/site-packages/cv2/…/…/lib64::/home/mujahid/anaconda3/pkgs/cuda-cudart-11.6.55-he381448_0/lib/libcudart.so.11.0
2023-03-26 16:31:41.925638: I tensorflow/compiler/xla/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2023-03-26 16:31:42.468206: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘libnvinfer.so.7’; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/mujahid/.local/lib/python3.8/site-packages/cv2/…/…/lib64::/home/mujahid/anaconda3/pkgs/cuda-cudart-11.6.55-he381448_0/lib/libcudart.so.11.0
2023-03-26 16:31:42.468298: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘libnvinfer_plugin.so.7’; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/mujahid/.local/lib/python3.8/site-packages/cv2/…/…/lib64::/home/mujahid/anaconda3/pkgs/cuda-cudart-11.6.55-he381448_0/lib/libcudart.so.11.0
2023-03-26 16:31:42.468305: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly."

@urek,

Welcome to the Tensorflow Forum!

You need to install the missing dependencies or update the LD_LIBRARY_PATH environment variable to include the correct paths to libraries.

To debug further, could you please tell us the steps that you have followed to install Tensorflow and the version details of tensorflow, CUDA, cuDNN?

Thank you!

I have installed the dependencies (reinstalling nvidia & cuda) which was found here

nvidia-smi gives me cuda 11.4

nvcc --version gives me 10.1

when I use conda list cudatoolkit - > 11.0
and for cudnn ->8.2

TF version → 2.11.1

@urek,

Could you please try as per tested build configurations:

We recommend you to follow instructions as mentioned here using pip.

Could you please try and let us know?

Thank you!

So, I reinstalled tensorflow 2.12, and followed the instructions on the website, now I get this…

Could not load dynamic library ‘libnvinfer.so.7’; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/mujahid/.local/lib/python3.8/site-packages/cv2/…/…/lib64::/home/mujahid/anaconda3/pkgs/cuda-cudar:/home/mujahid/anaconda3/envs/rl_env/lib:/home/mujahid/anaconda3/pkgs/cuda-cudart-11.6.55-he381448_0/lib/libcudart.so.11.0:/home/mujahid/anaconda3/envs/rl_env/lib/python3.8/site-packages/nvidia/cuda_runtime/lib/libcudart.so.11.0
2023-03-27 14:31:13.166417: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘libnvinfer_plugin.so.7’; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/mujahid/.local/lib/python3.8/site-packages/cv2/…/…/lib64::/home/mujahid/anaconda3/pkgs/cuda-cudar:/home/mujahid/anaconda3/envs/rl_env/lib:/home/mujahid/anaconda3/pkgs/cuda-cudart-11.6.55-he381448_0/lib/libcudart.so.11.0:/home/mujahid/anaconda3/envs/rl_env/lib/python3.8/site-packages/nvidia/cuda_runtime/lib/libcudart.so.11.0

I created a new env based on python 3.9

@urek,

Your LD_LIBRARY_PATH is incorrect, it should point to the actual folder containing .so files.

Can you try setting a symbolic link from libnvinfer version 7 to 8 as shown below:

# the following path will be different for you - depending on your install method
$ cd env/lib/python3.9/site-packages/tensorrt

# create symbolic links
$ ln -s libnvinfer_plugin.so.8 libnvinfer_plugin.so.7
$ ln -s libnvinfer.so.8 libnvinfer.so.7

# add tensorrt to library path
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/env/lib/python3.9/site-packages/tensorrt/

Thank you!