无法在 Ubuntu 16.04 上安装 TensorRT 4.0

无法在 Ubuntu 16.04 上安装 TensorRT 4.0

我尝试在从源代码安装 TensorFlow 1.8 之前安装 TensorRT。当我按照给出的文档操作时这里我在安装 TensorRT 4.0 时遇到错误。我得到的错误是:

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.

当我使用

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

我没有看到任何软件包。我不确定如何继续。我正在使用 CUDA 9.0 和 cuDNN 7.0.5。

答案1

我遇到过同样的问题。

环境

  • Ubuntu 16.04
  • CUDA 9.0

解决方案:

我认为您可能通过 .run 文件安装 cuda。如果是这样,您应该将其删除并通过 .deb 文件重新安装 cuda。

跑步

dpkg-query -W | grep cuda-cublas

那么如果输出是这样的:

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

那么你的问题就解决了。

答案2

使用 Ubuntu 16.04 和 CUDA 10.1 通过 deb 安装 TensorRT 6.0.1.5 时出现同样的问题。

另一个答案对我不起作用,但我遵循了@Terrance 的评论

也许可以先尝试通过以下方式安装 CUDA 16.04:https://askubuntu.com/a/1025949/231142它确实安装了您所显示的 cuda-cublas 缺少的依赖项。

在我重新安装 CUDA 后,TensorRT 可以顺利安装,没有任何错误。但是,当我import tensorrt在 python 中尝试时,我得到了module not found error。这在导入错误:没有名为“tensorrt”的模块

相关内容