How to import tensorrt in python on jetson nx

Description: I am using a Jetson Xavier NX with Jetpack 5.1.1, which comes with CUDA 11.4.19, TensorRT 8.5.2, and cuDNN 8.6.0 pre-installed. (Reference: Jetpack 5.1.1). However, I encountered an issue when trying to use the Python API to work with .engine or .trt models, as I am unable to import the tensorrt package.

To address this, I downloaded the TensorRT wheel file from the official NVIDIA website (TensorRT 8.x Download), but I noticed that it only provides ARM SBSA versions, and there were no specific versions listed for CUDA 11.4. I downloaded a version that was closest to CUDA 11.4, but I’m unsure if the ARM SBSA series of TensorRT is compatible with Jetson NX.

After downloading TensorRT-, I successfully imported tensorrt using the wheel file. However, I encountered another issue that the version intended for CUDA 11.8 couldn’t properly work with my current CUDA version on Jetson NX (11.4).

Currently, in my environment, Torch is able to detect CUDA and shows True when I use torch.cuda.is_available(). However, when I try to use TensorRT or ONNX Runtime to execute any CUDA-related task, it gives the error message “CUDA initialization failure with error 222. Please check your CUDA installation.”

I am unsure how to proceed from here. My objective is to compile TensorRT files using the Python API on Jetson NX. Should I reflash Jetpack? Are there any other potential solutions?

Thank you for your assistance!


The ARM SBSA package cannot be used on Jetson.
Please try the below to set up the Python TensorRT package.

  1. Reflash and install all the pacakge from JetPack 5.1.1.
  2. Install Python TensorRT via apt:
$ sudo apt install python3-libnvinfer*


1 Like

Thank you for your previous help, which successfully resolved my issue. Now I can use TensorRT successfully.

Could you please help me with a Python implementation example that is suitable for use on Jetson NX? For instance, I have an .onnx file generated from YOLOv8, and I would like to convert it to a .trt file for detection. I noticed that on NX, some Python packages, such as pycuda, seem to have limited support, so I’m unsure about which combination of packages I can use to achieve the desired functionality.

My goal is to have a sample code that demonstrates detection on NX.

Thank you in advance for your assistance!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.