Import tensorrt as trt fails

Hi,

My current version:
Ubuntu 20.04
JetPack 4.5.1
Cuda 10.2
TensorRT 7.1.3.0
Jetson AGX Xavier

I have a problem when trying to import the tensorrt library in a python script. The error is the following:

“Traceback (most recent call last):
File “onnx_to_tensorrt.py”, line 54, in
import tensorrt as trt
File “/usr/lib/python2.7/dist-packages/tensorrt/init.py”, line 66, in
from .tensorrt import *
ImportError: libnvrtc.so.10.2: cannot open shared object file: No such file or directory”

Upon further inspection, I noticed there are several CUDA libraries missing in the /usr/local/cuda-10.2/lib64 directory (which aren’t missing in the /usr/local/cudo-10.1/lib64 directory), among them libnvrtc.

I first thought of uninstalling and reinstalling CUDA 10.2 but this isn’t possible on ubuntu 20.04. CUDA 10.2 comes with the Nvidia JetPack SDK so I don’t see how to re-install CUDA 10.2 without having to re-install the whole JetPack SDK. This seems to be a sub-optimal solution.

I have two questions:

  • Why are some CUDA libraries missing from the /usr/local/cuda-10.2 directory ?

  • How can I add the missing libraries so that I can import the tensorrt python API.

Hi,

Do you run the onnx_to_tensorrt.py script on host or Jetson?
Please noted that you will need to convert the TensorRT engine on the target device directly.

More, could you try to run the script with python3 rather than python.
Thanks.