Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing TensorRT- facing issue with libnvinfer7 library (Cuda 10.2) on ubuntu 18.04

I was trying to install tensorRT 7.0 in ubuntu 18.4 (nv-tensorrt-repo-ubuntu1804-cuda10.2-trt7.0.0.11-ga-20191216_1-1_amd64.deb) debian.

Followed the documentation https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing-debian.

I am getting the below error with libnvinfer7. Searching for this around the planet, unable to find, lost my time and sleep. Kindly help me out with this:

 amarnath@amarnath-Precision-T3610:/opt/pixuate$ sudo apt install tensorrt
    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
    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:
     tensorrt : Depends: libnvinfer7 (= 7.0.0-1+cuda10.2) but it is not going to be installed
                Depends: libnvinfer-plugin7 (= 7.0.0-1+cuda10.2) but it is not going to be installed
                Depends: libnvparsers7 (= 7.0.0-1+cuda10.2) but it is not going to be installed
                Depends: libnvonnxparsers7 (= 7.0.0-1+cuda10.2) but it is not going to be installed
                Depends: libnvinfer-bin (= 7.0.0-1+cuda10.2) but it is not going to be installed
                Depends: libnvinfer-dev (= 7.0.0-1+cuda10.2) but it is not going to be installed
                Depends: libnvinfer-plugin-dev (= 7.0.0-1+cuda10.2) but it is not going to be installed
                Depends: libnvparsers-dev (= 7.0.0-1+cuda10.2) but it is not going to be installed
                Depends: libnvonnxparsers-dev (= 7.0.0-1+cuda10.2) but it is not going to be installed
                Depends: libnvinfer-samples (= 7.0.0-1+cuda10.2) but it is not going to be installed
                Depends: libnvinfer-doc (= 7.0.0-1+cuda10.2) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

Well, tried "sudo apt-get install python3-libnvinfer-dev"

amarnath@amarnath-Precision-T3610:/opt/pixuate$ sudo apt-get install python3-libnvinfer-dev
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
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-dev : Depends: python3-libnvinfer (= 7.0.0-1+cuda10.2) but it is not going to be installed
                          Depends: libnvinfer-dev (= 7.0.0-1+cuda10.2) but it is not going to be installed
                          Depends: libnvinfer-plugin-dev (= 7.0.0-1+cuda10.2) but it is not going to be installed
                          Depends: libnvparsers-dev (= 7.0.0-1+cuda10.2) but it is not going to be installed
                          Depends: libnvonnxparsers-dev (= 7.0.0-1+cuda10.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
like image 520
Amarnath R Avatar asked May 28 '20 08:05

Amarnath R


2 Answers

In the TensorRT installation section from https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html there is this sentence:

requires that the CUDA Toolkit and cuDNN have also been installed using Debian or RPM packages

If you install the CUDA toolkit and cuDNN using deb files the unmet dependencies error should be resolved.

NOTE: Before installing check the versions of Ubuntu, CUDA and cuDNN you want to install. In the installation tips below CUDA 10.2 and cuDNN 7.6.5 were used. This is tested for TensorRT 7.0.0.

CUDA .deb install

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804x86_64cuda-ubuntu1804.pin  
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

CUDNN .deb install

First download the .deb files:

  1. cuDNN Developer Library for Ubuntu18.04 (Deb)
  2. cuDNN Runtime Library for Ubuntu18.04 (Deb)

After that install the downloaded packages:

sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb
sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.2_amd64.deb

NOTE: These installation instructions are from the official nvidia web sites

like image 145
navi2607 Avatar answered Nov 13 '22 10:11

navi2607


By default, the system will try to upgrade the libnvinfer versions to the most latest ones (including upgrading CUDA to version 11.x).

So we first need to install the necessary versions and then place a hold on them to restrict any automatic upgrade attempts that may cause unmet dependencies.

sudo apt-get install libnvinfer7=7.0.0-1+cuda10.2 libnvonnxparsers7=7.0.0-1+cuda10.2 libnvparsers7=7.0.0-1+cuda10.2 libnvinfer-plugin7=7.0.0-1+cuda10.2 libnvinfer-dev=7.0.0-1+cuda10.2 libnvonnxparsers-dev=7.0.0-1+cuda10.2 libnvparsers-dev=7.0.0-1+cuda10.2 libnvinfer-plugin-dev=7.0.0-1+cuda10.2  python3-libnvinfer=7.0.0-1+cuda10.2

sudo apt-mark hold libnvinfer7 libnvonnxparsers7 libnvparsers7 libnvinfer-plugin7 libnvinfer-dev libnvonnxparsers-dev libnvparsers-dev libnvinfer-plugin-dev python3-libnvinfer python3-libnvinfer-dev

After that you can install tensorrt without any problems:

sudo apt-get install tensorrt
like image 2
mohamed_abdullah Avatar answered Nov 13 '22 10:11

mohamed_abdullah