Can't use TensorRT in Ubuntu 20.04 with Python3.8


I Want To Install TensorRT on my System and Convert TensorFlow SSD-Mobilenet to the TensorRT model for performance improvement.
I Followed Step by Step Installation Guild in Nvidia Documentation but when I want to install python3-libnvinfer-dev and python3-libnvinvfer package with:

sudo apt-get install python3-libnvinfer-dev 
sudo apt-get install python3-libnvinfer

I’ll get this Error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
a 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.

I Try to Install This By Python 3.7 but still get this Error!!
how can I Solve this problem?


TensorRT Version: 8.4
GPU Type: GTX 1080 Ti
CUDA Version: 10.1
Operating System + Version: Ubuntu 20.04
Python Version (if applicable): Python3.7 - Python3.8
TensorFlow Version (if applicable): 2.11.0


We recommend that you use the most recent TensorRT version 8.5.3.

Could you please check the Python versions installed on your system by ls -ls /usr/bin/python* and make sure only one Python version is correctly installed.

To avoid setup-related issues, you can also try the TensorRT NGC container if interested.

Thank you.

Thank’s a lot for your reply by Topic
There are multiple Python versions installed on my Ubuntu OS
2.7 - 3.7 - 3.8
which one do you think should I keep?
I Can’t Uninstall the 2.7 version because I think some apps and features depend on this version of python.
and one more question, can I use TensorRT and Convert my Tensorflow SSD mobile net to the TensorRT model?
seems like TensorRT 8.5.3 does not exist for Ubuntu 20.04 and CUDA 10.2 or 10.1

Hi Again
I have uninstalled Python3.7 and run ls -ls /usr/bin/python* again and got this result:

0 lrwxrwxrwx 1 root root       7 آوریل   15  2020 /usr/bin/python -> python3
   0 lrwxrwxrwx 1 root root       9 جولای   19  2022 /usr/bin/python3 -> python3.8
5368 -rwxr-xr-x 1 root root 5494584 نوْوامبر 14 16:29 /usr/bin/python3.8
   0 lrwxrwxrwx 1 root root      33 نوْوامبر 14 16:29 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config
   0 lrwxrwxrwx 1 root root      16 مارس    13  2020 /usr/bin/python3-config -> python3.8-config
   4 -rwxr-xr-x 1 root root     384 ژانویه  25 12:03 /usr/bin/python3-futurize
   4 -rwxr-xr-x 1 root root     388 ژانویه  25 12:03 /usr/bin/python3-pasteurize

and try again to install python3-libnvinfer-dev but the Error is still there…

I want to work with SSD-Mobilenet custom-trained model and convert it to TensorRT, I don’t think containers work for me. does it?

Based on the error, you need to keep 3.7.

Also, we recommend you to please make sure, you’re following the installation steps correctly.
Please try debian installation.

This step not required.

Thank you.

Thank you so much , I don’t know about that (installing python3-libnvinfer is not required)
that’s solved my problem

How do I solve this issue?

It looks similar, but I have following the instructions from Installation Guide :: NVIDIA Deep Learning TensorRT Documentation

I have been trying for days and recreating virtual machines but no luck.

I am trying to install on Ubuntu 20.04 on the SURF Research Cloud with Jupyter Labs through the console.

Can I please get some assistance.

did you try the Debian installation?
try Step-by-Step.

Hi Kambiz,

Yes I have tried.

I downloaded the .deb files locally and then moved them to my VM where I am working.

This is for CUDA installation, the CUDNN installation and the Tensorrt installation.

There were some issues with the public keys which I fixed from looking at other forums.

It is really challenging because the guides do not seem updated, I have tried multiple times.

I also checked my Ubuntu version and CUDA version to ensure the right installations are used.


We recommend you create a new post with more details, including steps followed, complete error logs, and environment details.

Thank you.

yes seems right, the installation guide is not explicitly updated for news tensorflow versions.
but now I don’t know how to solve this problem, just trying these commands randomly and (again and again) finally it works…
I don’t think I can do this one more time on another jetson because I don’t remember anything…

@spolisetty Can you please provide a summary of the main steps? I am running from the Ubuntu machine 20.04 on the Netherlands SURF Research Cloud. There is only the Jupyter Lab and the console. I will create the new post shortly.

Also which of these guides would you recommend to follow first?

At this stage, I am downloading the .deb files and then transferring to my Virtual Machine where I am running the commands to try to set up.

My main objective is to try to get TensorFlow to work with the GPU mode. The GPU drivers are already installed from the setup which SURF provides.

@Hamzeh.nv Yes, I agree. The same challenge you are describing I am experiencing. When something fails its just the running of random commands because the guide does not seem to provide everything. I really need some assistance here.

1 Like

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