# Could not load dynamic library 'libnvinfer.so.7'

**URL:** <https://forums.developer.nvidia.com/t/could-not-load-dynamic-library-libnvinfer-so-7/254736>\
**Category:** TensorRT\
**Tags:** tensorrt, cuda, python\
**Created:** [May 29, 2023, 3:14am UTC](https://forums.developer.nvidia.com/t/could-not-load-dynamic-library-libnvinfer-so-7/254736 "2023-05-29T03:14:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![joguiguma](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/joguiguma/32/254543_2.png) [@joguiguma](https://forums.developer.nvidia.com/u/joguiguma)\
**Post date:** [May 29, 2023, 3:14am UTC](https://forums.developer.nvidia.com/t/could-not-load-dynamic-library-libnvinfer-so-7/254736/1 "2023-05-29T03:14:38Z")

</div>

## Description

I have a laptop with Ubuntu 20 Geforce RTX 3060, drivers 470, cuda 11.4, CUDNN 8.1, Python 3.8 and Tensorflow 2.10, I hace also instaled tensoRT using:

pip install nvidia-pyindex  
pip install nvidia-tensorrt  
When I try to run tensorflow I have te next messages:

2023-05-28 22:08:39.240187: W tensorflow/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: /usr/local/cuda/lib64  
2023-05-28 22:08:39.240222: W tensorflow/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: /usr/local/cuda/lib64  
2023-05-28 22:08:39.240226: 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.

I read a lot of blog however I could not solve this problema.

## Environment

**TensorRT Version** :  
**GPU Type** :  
**Nvidia Driver Version** :  
**CUDA Version** :  
**CUDNN Version** :  
**Operating System + Version** :  
**Python Version (if applicable)**:  
**TensorFlow Version (if applicable)**:  
**PyTorch Version (if applicable)**:  
**Baremetal or Container (if container which image + tag)**:

## Relevant Files

Please attach or include links to any models, data, files, or scripts necessary to reproduce your issue. (Github repo, Google Drive, Dropbox, etc.)

## Steps To Reproduce

Please include:

- Exact steps/commands to build your repro
- Exact steps/commands to run your repro
- Full traceback of errors encountered

---

<div class="post-metadata">

**Author:** ![spolisetty](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/spolisetty/32/14047_2.png) [@spolisetty](https://forums.developer.nvidia.com/u/spolisetty)\
**Post date:** [May 30, 2023, 10:01am UTC](https://forums.developer.nvidia.com/t/could-not-load-dynamic-library-libnvinfer-so-7/254736/5 "2023-05-30T10:01:00Z")

</div>

Hi,

It looks like some TensorRT is not correctly installed.  
Please refer to the installation steps from the below link if in case you are missing on anything

> **[Installation Guide :: NVIDIA Deep Learning TensorRT Documentation](https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html)**
>
> This NVIDIA TensorRT 8.6.1 Installation Guide provides the installation requirements, a list of what is included in the TensorRT package, and step-by-step instructions for installing TensorRT.

Also, we suggest you use TRT NGC containers to avoid any system dependency related issues.

> **[TensorRT | NVIDIA NGC](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/tensorrt)**
>
> NVIDIA TensorRT is a C++ library that facilitates high-performance inference on NVIDIA graphics processing units (GPUs). TensorRT takes a trained network and produces a highly optimized runtime engine that performs inference for that network.

Thanks!

---

<div class="post-metadata">

**Author:** ![joguiguma](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/joguiguma/32/254543_2.png) [@joguiguma](https://forums.developer.nvidia.com/u/joguiguma)\
**Post date:** [June 7, 2023, 1:04am UTC](https://forums.developer.nvidia.com/t/could-not-load-dynamic-library-libnvinfer-so-7/254736/6 "2023-06-07T01:04:58Z")

</div>

> [@spolisetty](#):
>
> TRT NGC

Thank you very much for your support. Before I try to install by [Installation Guide :: NVIDIA Deep Learning TensorRT Documentation](https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html), I check if I have installed tensorrt obtaining:

:~$ python3  
Python 3.8.10 (default, Mar 13 2023, 10:26:41)  
[GCC 9.4.0] on linux  
Type “help”, “copyright”, “credits” or “license” for more information.

> > > import tensorrt  
> > > print(tensorrt. **version** )  
> > > 8.4.3.1  
> > > assert tensorrt.Builder(tensorrt.Logger())

It looks like I have installed Tensorrt. However, running Python 3 with tensorflow I obtained the following error message:

2023-06-06 19:58:53.291121: W tensorflow/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: /usr/local/cuda/lib64  
2023-06-06 19:58:53.291192: W tensorflow/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: /usr/local/cuda/lib64  
2023-06-06 19:58:53.291198: 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.

What can I do?

---

<div class="post-metadata">

**Author:** ![spolisetty](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/spolisetty/32/14047_2.png) [@spolisetty](https://forums.developer.nvidia.com/u/spolisetty)\
**Post date:** [June 9, 2023, 10:10am UTC](https://forums.developer.nvidia.com/t/could-not-load-dynamic-library-libnvinfer-so-7/254736/7 "2023-06-09T10:10:18Z")

</div>

Hi,

We recommend you to uninstall existing and reinstall TensorRT correctly, also please use the latest version of the TensorFlow.

Thank you.
