0

I am trying to install TensorRT before installing TensorFlow 1.8 from source. When I follow the documentation given here, I run into an error when installing TensorRT 4.0. The error I get is:

nivedithak@nivii-Sum18:~/Downloads$ sudo apt-get install tensorrt
[sudo] password for nivedithak: 
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: libnvinfer4 (>= 4.1.2) but it is not going to be installed
            Depends: libnvinfer-dev (>= 4.1.2) but it is not going to be installed
            Depends: libnvinfer-samples (>= 4.1.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

When I use

nivedithak@nivii-Sum18:~/Downloads$ apt-mark showhold

I don't see any packages. I am not sure how to get ahead. I am using CUDA 9.0 with cuDNN 7.0.5.

  • 1
    You could try installing the packages that tensorrt depends on. sudo apt-get install --dry-run tensorrt libnvinfer4 libnvinfer-dev libnvinfer-samples Remove --dry-run to do it For Real. – waltinator Jun 26 '18 at 20:15
  • It results in:

    The following packages have unmet dependencies: libnvinfer4 : Depends: cuda-cublas-9-0 but it is not installable E: Unable to correct problems, you have held broken packages.

    I did install the CUDA 9.0 from the deb file. I am unsure why it is missing dependencies

    – pragmaticprog Jun 26 '18 at 20:52
  • Maybe try installing CUDA for 16.04 this way first: https://askubuntu.com/a/1025949/231142 which does install the missing dependencies of cuda-cublas that you are showing. – Terrance Jun 27 '18 at 13:39

2 Answers2

1

I had the same issue.

Environment

  • ubuntu 16.04
  • cuda 9.0

Solution:

I think that you may install the cuda by .run file. If that's true, u should remove it and reinstall cuda by .deb file.

run

dpkg-query -W | grep cuda-cublas

then if outputs is something like this :

cuda-cublas-9-0 9.0.176-1
cuda-cublas-dev-9-0 9.0.176-1

then your issue will be solved.

0

Same issue when install TensorRT 6.0.1.5 by deb with Ubuntu 16.04 and CUDA 10.1.

The other answer doesn't work for me, but I followed @Terrance's comment:

Maybe try installing CUDA for 16.04 this way first: https://askubuntu.com/a/1025949/231142 which does install the missing dependencies of cuda-cublas that you are showing.

After I reinstalled CUDA, TensorRT can be installed smoothly without any error. However, when I tried import tensorrt in python, I got the module not found error. This is solved in ImportError: No module named 'tensorrt'.

Lorenz Keel
  • 8,905