Python3 binding for TensorRT - Jetson AGX Xavier

Description

Hi!
I’m encountering an issue when trying to run a python3 script using the TensorRT API. When i try to execute such a script, it returns the following error:
ModuleNotFoundError: No module named 'tensorrt'

Upon further inspection, I realized python3-libnvinfer and python3-libnvinfer-dev are not installed.

I tried sudo apt-get install -y python3-libnvinfer but this returns:
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

The following packages have unmet dependencies: python3-libnvinfer : Depends: python3 (< 3.7) but 3.8.2-0ubuntu2 is to be installed E: Unable to correct problems, you have held broken packages.

Next, I went on to check sudo apt-cache show python3-libnvinfer-dev python3-libnvinfer which returned:
Package: python3-libnvinfer-dev Source: tensorrt Version: 7.1.3-1+cuda10.2 Architecture: arm64 Maintainer: cudatools <cudatools@nvidia.com> Installed-Size: 10 Depends: python3-libnvinfer (= 7.1.3-1+cuda10.2), libnvinfer-dev (= 7.1.3-1+cuda10.2), libnvinfer-plugin-dev (= 7.1.3-1+cuda10.2), libnvparsers-dev (= 7.1.3-1+cuda10.2), libnvonnxparsers-dev (= 7.1.3-1+cuda10.2) Priority: optional Section: multiverse/devel Filename: pool/main/t/tensorrt/python3-libnvinfer-dev_7.1.3-1+cuda10.2_arm64.deb Size: 3612 Description: Python 3 development package for TensorRT Python 3 development package for TensorRT.

Package: python3-libnvinfer Source: tensorrt Version: 7.1.3-1+cuda10.2 Architecture: arm64 Maintainer: cudatools <cudatools@nvidia.com> Installed-Size: 2353 Depends: python3 (>= 3.6), python3 (<< 3.7), libnvinfer7 (= 7.1.3-1+cuda10.2), libnvinfer-plugin7 (= 7.1.3-1+cuda10.2), libnvparsers7 (= 7.1.3-1+cuda10.2), libnvonnxparsers7 (= 7.1.3-1+cuda10.2) Priority: optional Section: multiverse/devel Filename: pool/main/t/tensorrt/python3-libnvinfer_7.1.3-1+cuda10.2_arm64.deb Size: 347162 Description: Python 3 bindings for TensorRT Python 3 bindings for TensorRT.

How can I correct this and use the python3 TensorRT API ?

Important side notes:

  • I’m using the JetPack 4.5.1 SDK
  • python2 TensorRT API works fine

Environment

TensorRT Version: 7.1.3-1
GPU Type: Jetson AGX Xavier
CUDA Version: 10.2
CUDNN Version: 8.0.0.180-1
Operating System + Version: Ubuntu 20.04
Python Version (if applicable): Python 3.6.9

Hi,

We only provide TensorRT package for python 3.6 user.
For other version, please compile it with pybinding.

You can find some information in our OSS source:

Thanks.

Hi! Thanks for your answer.
My python version is precisely 3.6.
Shouldn’t it be working then?

Thanks!

Hi,

The TensorRT python package is included in the JetPack.
In general, if you install all the components from JetPack, TensorRT should be preinstalled already.

Would you mind to use SDK manager to setup the components again?
Thanks.