Unmet dependencies while installing TensorRT 7.1

Description

I am trying to install the TensorRT 7.1 on Ubuntu18.04 for pytorch 1.15 according to debian install guide but it reported this error.

Error:

The following packages have unmet dependencies:
 tensorrt : Depends: libnvinfer7 (= 7.1.3-1+cuda10.2) but it is not going to be installed
            Depends: libnvinfer-plugin7 (= 7.1.3-1+cuda10.2) but it is not going to be installed
            Depends: libnvparsers7 (= 7.1.3-1+cuda10.2) but it is not going to be installed
            Depends: libnvonnxparsers7 (= 7.1.3-1+cuda10.2) but it is not going to be installed
            Depends: libnvinfer-bin (= 7.1.3-1+cuda10.2) but it is not going to be installed
            Depends: libnvinfer-dev (= 7.1.3-1+cuda10.2) but it is not going to be installed
            Depends: libnvinfer-plugin-dev (= 7.1.3-1+cuda10.2) but it is not going to be installed
            Depends: libnvparsers-dev (= 7.1.3-1+cuda10.2) but it is not going to be installed
            Depends: libnvonnxparsers-dev (= 7.1.3-1+cuda10.2) but it is not going to be installed
            Depends: libnvinfer-samples (= 7.1.3-1+cuda10.2) but it is not going to be installed
            Depends: libnvinfer-doc (= 7.1.3-1+cuda10.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

cuda and cudnn info

~dpkg-query -W | grep cuda                    
libcudnn7	7.6.5.32-1+cuda10.2
libcudnn7-dev	7.6.5.32-1+cuda10.2
libcudnn7-doc	7.6.5.32-1+cuda10.2
nv-tensorrt-repo-ubuntu1804-cuda10.2-trt7.1.3.4-ga-20200617	1-1


~apt-cache show python3-libnvinfer-dev python3-libnvinfer
Package: python3-libnvinfer-dev
Priority: optional
Section: multiverse/devel
Installed-Size: 10
Maintainer: cudatools <cudatools@nvidia.com>
Architecture: amd64
Source: tensorrt
Version: 7.1.3-1+cuda10.2
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)
Filename: ./python3-libnvinfer-dev_7.1.3-1+cuda10.2_amd64.deb
Size: 3616
MD5sum: 4aab1d643080e9e39ab323fef428a899
SHA1: 798a158c3b68efe03b8126f5a03d104a46e6a98d
SHA256: 0b0e4ef11bd7a76eaec8f83b5cc93d1a8e5ea2a38a5f55d9dd559409f5a54b57
SHA512: 60f0c3bd4870fc94adab259eea9c2ead0ae2fb94ebabf02aa9725af0ac942493d0276efb358fe17edd92dca99b895e535f0419d0e765f2ee7a1f40ca7f4db24d
Description: Python 3 development package for TensorRT
 Python 3 development package for TensorRT.
Description-md5: 858edc4abbfaf2883142085c85b93202

Package: python3-libnvinfer
Priority: optional
Section: multiverse/devel
Installed-Size: 2230
Maintainer: cudatools <cudatools@nvidia.com>
Architecture: amd64
Source: tensorrt
Version: 7.1.3-1+cuda10.2
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)
Filename: ./python3-libnvinfer_7.1.3-1+cuda10.2_amd64.deb
Size: 359242
MD5sum: f55e0cc12573677424e3401e4b05c87a
SHA1: 36882ec2fc49b3f89ee3ff827f2791011e5eb757
SHA256: a810c3b22cff8c184871fe8fbf7562e74d7f8013c9ff84611ceb196177e4727f
SHA512: 2594e31953fd4c17d51476ffde1354e023aa72105706c3496c76f169c14b62224032c1b2d43cc4706ff401d9bb574a10dfd5c0efd338c2a1c00ce37e91494b8b
Description: Python 3 bindings for TensorRT
 Python 3 bindings for TensorRT.
Description-md5: f33add15e2b8d80e2af8ee9c829c9180

Installation Sequence

sudo dpkg -i '/home/htut/Downloads/nv-tensorrt-repo-ubuntu1804-cuda10.2-trt7.1.3.4-ga-20200617_11_amd64.deb' 
sudo apt-key add /var/nv-tensorrt-repo-cuda10.2-trt7.1.3.4-ga-20200617/7fa2af80.pub
sudo apt-get update
sudo apt-get install tensorrt

Any solution to this? I use python 3.6 in anaconda environments.

Hi @Htut,
Please retry the steps as mentioned in this link:
You can also try the other installation approaches as well like tar or zip.

Also, please check the support matrix of the TRT release.
https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-713/support-matrix/index.html#platform-matrix

You can also use NGC container to avoid system level dependencies.
https://ngc.nvidia.com/catalog/containers?orderBy=modifiedDESC&pageNumber=0&query=&quickFilter=containers&filters=

Thanks!

Hi. Thanks for the reply. I tried all of your recommended ways but it couldn’t fix my issue. After searching for a solution all over the place, I tried uninstalling cuda, cudnn and reinstall all of it from scratch by using debian because at first cuda-10-2 was installed by using run file instead of debian. Luckily, this time I can install the TensorRT without no issue or whatsover.

~dpkg -l | grep TensorRT
ii  libnvinfer-bin                                              7.1.3-1+cuda10.2                                 amd64        TensorRT binaries
ii  libnvinfer-dev                                              7.1.3-1+cuda10.2                                 amd64        TensorRT development libraries and headers
ii  libnvinfer-doc                                              7.1.3-1+cuda10.2                                 all          TensorRT documentation
ii  libnvinfer-plugin-dev                                       7.1.3-1+cuda10.2                                 amd64        TensorRT plugin libraries
ii  libnvinfer-plugin7                                          7.1.3-1+cuda10.2                                 amd64        TensorRT plugin libraries
ii  libnvinfer-samples                                          7.1.3-1+cuda10.2                                 all          TensorRT samples
ii  libnvinfer7                                                 7.1.3-1+cuda10.2                                 amd64        TensorRT runtime libraries
ii  libnvonnxparsers-dev                                        7.1.3-1+cuda10.2                                 amd64        TensorRT ONNX libraries
ii  libnvonnxparsers7                                           7.1.3-1+cuda10.2                                 amd64        TensorRT ONNX libraries
ii  libnvparsers-dev                                            7.1.3-1+cuda10.2                                 amd64        TensorRT parsers libraries
ii  libnvparsers7                                               7.1.3-1+cuda10.2                                 amd64        TensorRT parsers libraries
ii  python3-libnvinfer                                          7.1.3-1+cuda10.2                                 amd64        Python 3 bindings for TensorRT
ii  python3-libnvinfer-dev                                      7.1.3-1+cuda10.2                                 amd64        Python 3 development package for TensorRT
ii  tensorrt                                                    7.1.3.4-1+cuda10.2                               amd64        Meta package of TensorRT

However, there comes another problem. Since I was using anaconda environments, I can’t import tensorrt from any of conda environments.

Python 3.7.4 (default, Aug 13 2019, 20:35:49) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorrt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorrt'

Is there anyway to install tensorrt to a specific conda environment?

Hi,
Can you pls check if tensorrt is installed in your conda environment python and not on the system python.
You can refer to the below links for details -



Thanks!

Hi,
Thanks for the reply again. Since the installation of tensorrt was done by using deb file, I couldn’t import the tensorrt from any of the conda environments. Just like the first post, I switched to system python instead of any of the conda environments and then I was successfully able to import the tensorrt in system python. But is there any way to install tensorrt to anaconda environments? I don’t want to touch system python for some reasons.

Hi @Htut,
Can you try using the whl files from the tar package to install TRT in anconda.
Hope this resolves the issue.
Thanks!

Maybe you can reference step 2 (it’s jetson platform)

This needs to be done because the python bindings to tensorrt are available in dist-packages and this folder is usually not visible to your virtualenv. To make them visible we add it to PYTHONPATH .

1 Like

Hi @Avalon ,
Sorry for the late reply. After exporting PYTONPATH, I was able export tensorrt from conda environments. Thanks!

Can you please share how did you solve it. I used deb file for installation and can’t import Tensorrt

@vermillionblu Sorry for the late reply. As far as I remember, I re-installed CUDA 10.2 by using deb file and then installed the TensorRT as mentioned in the Installation guide. Then I exported path of base python packages in source file.

export PATH="/usr/src/tensorrt/bin:$PATH"
export PYTHONPATH=/usr/lib/python3.6/dist-packages:$PYTHONPATH

After that, I was able to import TensorRT from conda environments.
I hope this answer would be helpful to you.

With regards,
Htut