Local installation of TensorRT8.2 on Ubuntu18.04 device


I want to use the local TensorRT8 in my C project.

I’am trying to install the TensorRT8.4 into my local Ubuntu18.04 machine (not the docker env).
The CUDA11.4 and cuDNN8.2 were installed by using the local run/tgz file, so I had to install the TensorRT by “tgz file”.

I’ve downloaded the “tar file” and unzipped.
Nextly, added the LD_LIBRARY_PATH to ~/.bashrc file below and updated it(source ~/.bashrc)

export LD_LIBRARY_PATH=/home/han/TensorRT-$LD_LIBRARY_PATH

But the thing is that,
the example_mnist runs well, but including the tensorrt header “NvInfer.h” is occurring the “No such file or directory” error when my C project compilation.
(I’ve checked LD_LIBRARY_PATH is correctly added by typing “echo $LD_LIBRARY_PATH” in the ubuntu terminal)

How can I fix the problem??
Even I included the header by "#include “correct/path/to/NvInfer.h” but occurs the another including path problem in “NvInfer.h” file.

Please help me guys :)


TensorRT Version: 8.4
GPU Type: Quadro RTX4000
Nvidia Driver Version: 470.94
CUDA Version: 11.4
CUDNN Version: 8.2
Operating System + Version: Ubuntu 18.04 LTS
Python Version (if applicable): python3
TensorFlow Version (if applicable): x
PyTorch Version (if applicable): x
Baremetal or Container (if container which image + tag): x

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

Please refer to the installation steps from the below link if in case you are missing on anything

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


I’ve already checked it, but couldn’t find any problem.
What would be the problem?
even I made my test code using cmake with FindTensorRT.cmake package finder(find_package(TensorRT REQUIRED) in CMakeLists.txt), but it also occurs “No such file or directory” error.


Could you please share us complete error logs.
Also, we recommend you to please make sure you installed TensorRT correctly (without any errors while installing). You can uninstall and try installing again by following steps carefully in the above installation guide.

Thank you.

Actually, It was my fault.

The installation is not needed if you are using the C++ API.
Just locate the unzipped TensorRT tar folder to some place and add the below line in the “CMakeLists.txt” with FindTensorRT.cmake file:

set(TensorRT_DIR “/path/to/TensorRT”) #-> you have to change the path to the correct TensorRT folder location

find_package(TensorRT REQUIRED)

You can search the “FindTensorRT.cmake” file on google (ex. FAST/FindTensorRT.cmake at master · smistad/FAST · GitHub)