9

我试图在 ubuntu 18.4 (nv-tensorrt-repo-ubuntu1804-cuda10.2-trt7.0.0.11-ga-20191216_1-1_amd64.deb) debian 中安装 tensorRT 7.0。

遵循文档https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing-debian

libnvinfer7 出现以下错误。在这个星球上寻找这个,找不到,失去了我的时间和睡眠。请帮我解决这个问题:

 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.

好吧,试过“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.
4

2 回答 2

6

https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html的 TensorRT 安装部分有这句话:

要求还使用 Debian 或 RPM 包安装了 CUDA Toolkit 和 cuDNN

如果您使用 deb 文件安装 CUDA 工具包和 cuDNN,则应解决未满足的依赖关系错误。

注意:在安装之前,请检查您要安装的 Ubuntu、CUDA 和 cuDNN 的版本。在下面的安装提示中使用了 CUDA 10.2 和 cuDNN 7.6.5。这是针对 TensorRT 7.0.0 测试的。

CUDA .deb 安装

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 安装

首先下载 .deb 文件:

  1. 用于 Ubuntu18.04 的 cuDNN 开发人员库(Deb)
  2. 用于 Ubuntu18.04 的 cuDNN 运行时库(Deb)

之后安装下载的包:

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

注意:这些安装说明来自官方 nvidia 网站

于 2020-06-04T10:42:34.233 回答
2

默认情况下,系统会尝试将libnvinfer版本升级到最新版本(包括将 CUDA 升级到 11.x 版本)。

因此,我们首先需要安装必要的版本,然后对它们进行暂停以限制任何可能导致未满足依赖项的自动升级尝试。

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

之后,您可以毫无问题地安装 tensorrt:

sudo apt-get install tensorrt
于 2021-10-18T14:28:00.413 回答