No module named 'tensorrt'

Hi,

I’m trying to import tensorrt in my python script but is saying No module named tensorrt though i did pip3 install tensorrt.

Jetpack 4.6.2(L4T 32.7.2)
CUDA 10.2
Tensorrt 8.2.1.8
Cudnn 8.2.1.32

Here’s the output for dpkg -l | grepTensorRT

mahesh@jetson-nano:~$ dpkg -l | grep TensorRT
ii  libnvinfer-bin                                8.2.1-1+cuda10.2                           arm64        TensorRT binaries
ii  libnvinfer-dev                                8.2.1-1+cuda10.2                           arm64        TensorRT development libraries and headers
ii  libnvinfer-doc                                8.2.1-1+cuda10.2                           all          TensorRT documentation
ii  libnvinfer-plugin-dev                         8.2.1-1+cuda10.2                           arm64        TensorRT plugin libraries
ii  libnvinfer-plugin8                            8.2.1-1+cuda10.2                           arm64        TensorRT plugin libraries
ii  libnvinfer-samples                            8.2.1-1+cuda10.2                           all          TensorRT samples
ii  libnvinfer8                                   8.2.1-1+cuda10.2                           arm64        TensorRT runtime libraries
ii  libnvonnxparsers-dev                          8.2.1-1+cuda10.2                           arm64        TensorRT ONNX libraries
ii  libnvonnxparsers8                             8.2.1-1+cuda10.2                           arm64        TensorRT ONNX libraries
ii  libnvparsers-dev                              8.2.1-1+cuda10.2                           arm64        TensorRT parsers libraries
ii  libnvparsers8                                 8.2.1-1+cuda10.2                           arm64        TensorRT parsers libraries
ii  nvidia-container-csv-tensorrt                 8.2.1.8-1+cuda10.2                         arm64        Jetpack TensorRT CSV file
ii  tensorrt                                      8.2.1.8-1+cuda10.2                         arm64        Meta package of TensorRT

Here’s the output for dpkg -l | grep nvinfer

mahesh@jetson-nano:~$ dpkg -l | grep nvinfer
ii  libnvinfer-bin                                8.2.1-1+cuda10.2                           arm64        TensorRT binaries
ii  libnvinfer-dev                                8.2.1-1+cuda10.2                           arm64        TensorRT development libraries and headers
ii  libnvinfer-doc                                8.2.1-1+cuda10.2                           all          TensorRT documentation
ii  libnvinfer-plugin-dev                         8.2.1-1+cuda10.2                           arm64        TensorRT plugin libraries
ii  libnvinfer-plugin8                            8.2.1-1+cuda10.2                           arm64        TensorRT plugin libraries
ii  libnvinfer-samples                            8.2.1-1+cuda10.2                           all          TensorRT samples
ii  libnvinfer8                                   8.2.1-1+cuda10.2                           arm64        TensorRT runtime libraries

And if the issue is due to python3-libnvinfer and python3-libnvinfer-dev please let me know how to install them. Itried pip3 install but getting the error

mahesh@jetson-nano:~$ sudo pip3 install libnvinfer
[sudo] password for proxmaq: 
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
ERROR: Could not find a version that satisfies the requirement libnvinfer (from versions: none)

Please help me to fix this issue.

if you go TensorRT SDK | NVIDIA Developer, you have to sign up for NVidia’s dev network and then you can download the .deb file to sudo apt get tensorrt.

Follow these instructions: Installation Guide :: NVIDIA Deep Learning TensorRT Documentation.

But i already have installed Tensorrt 8.2.1. I’ve got it from SDK manager which is downloaded all packages into my host Linux machine and i installed by myself.

This issue is cleared. I just installed python3-libnvinfer and python3-libnvinfer-dev using sudo apt-get install python3-libnvinfer and sudo apt-get install python3-libnvinfer-dev commands.

Thanks for your time k71196 :)

2 Likes

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