Fatal error: NvInfer.h: No such file or directory

Description

I have installed TensorRT following the tar method shown on Nvidia docs. I am trying to convert PyTorch .pt file to TensorRT for performance, as shown in this. I am encountering an error in the second step (In make command), which is

fatal error: NvInfer.h: No such file or directory

I am able to locate this file at ~/TensorRT-7.2.1.6/include/NvInfer.h
Path of TensorRT is also exported in my .bashrc file as shown in the docs. I did find solutions for this problem on other sites (Github, StackOverflow), but it talks about DEB installation method of TensorRT rather than TAR installation method which I used. Though, I am able to import TensorRT in python successfully without any errors. How can I make it work?

Environment

TensorRT Version: 7.2.1.6
GPU Type: GeForce 940MX
Nvidia Driver Version: 455
CUDA Version: 11.1
CUDNN Version: 8.0.5
Operating System + Version: Ubuntu 18.04
Python Version (if applicable): 3.7
PyTorch Version (if applicable): 1.7

How stupid of me to not check issues. Here’s solution in case anyone runs into it.

1 Like