在 ubuntu 18.04 上使用 libnvinfer7 库(Cuda 10.2)安装 TensorRT 面临的问题
Posted
技术标签:
【中文标题】在 ubuntu 18.04 上使用 libnvinfer7 库(Cuda 10.2)安装 TensorRT 面临的问题【英文标题】:Installing TensorRT- facing issue with libnvinfer7 library (Cuda 10.2) on ubuntu 18.04 【发布时间】:2020-09-15 12:44:46 【问题描述】:我试图在 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.
【问题讨论】:
你读过这个:docs.nvidia.com/deeplearning/tensorrt/install-guide/… ? @talonmies 是的,按照文档中的确切步骤进行操作。 您在问题中没有提到这一点。另外,这是一个“抢先体验”的候选人,所以它很可能行不通。联系英伟达。我已经投票结束了,这里不是主题 @talonmies 正在编辑它 askubuntu.com/questions/363200/… 【参考方案1】:在https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html的TensorRT安装部分有这句话:
要求 CUDA Toolkit 和 cuDNN 也已使用 Debian 或 RPM 包安装
如果您使用 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 文件:
-
适用于 Ubuntu18.04 的 cuDNN 开发人员库(Deb)
适用于 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 官方网站
【讨论】:
【参考方案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
【讨论】:
谢谢。有用。我很难安装旧库!以上是关于在 ubuntu 18.04 上使用 libnvinfer7 库(Cuda 10.2)安装 TensorRT 面临的问题的主要内容,如果未能解决你的问题,请参考以下文章
在 Ubuntu 18.04 上使用静态可执行文件安装 Docker CE 及后续设置
在 Ubuntu 18.04 上使用静态可执行文件安装 Docker CE 及后续设置