在 ubuntu 18.04 上安装 libnvinfer7 库 (Cuda 10.2) 的 TensorRT 问题



我试图在 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.

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

要求 CUDA 工具包和 cuDNN 也已使用 Debian 或 RPM 软件包安装

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

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

库达.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. cuDNN Developer Library for Ubuntu18.04 (Deb(
  2. cuDNN Runtime Library for Ubuntu18.04 (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 官方网站

默认情况下,系统将尝试将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

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

sudo apt-get install tensorrt

我在tensorrt 8.2.5-1cuda11.6有这个问题:

张量:取决于:libnvinfer-samples(= 8.2.5-1+cuda11.4(,但它不会被安装

通过安装cuda 11.7tensorrt 8.4.1.5来解决。

TensorRT 安装失败,缺少 libnvinfer 样本

最新更新