Install TensorRT using tar file

本文档记录了使用tar文件在Ubuntu18.04上安装TensorRT的过程,包括遇到的问题及解决方法。首先,介绍了不同安装方式的优缺点,如deb和rpm安装需要管理员权限,灵活性较低;tar文件安装则需要手动处理依赖。最终选择了tar文件安装,但在安装后发现库文件未在anaconda环境中,通过手动复制解决了导入问题,又因找不到libnvinfer.so.5库文件,从TensorRT目录复制到/usr/lib/解决了导入错误。
摘要由CSDN通过智能技术生成

Versions

Ubuntu18.04
Python3.6
CUDA10.0
CuDNN7

Progress

The installation progress mostly refers to the official installation guide

At first I thought it would be easier to use deb installation, but there are certain restrictions that I didn’t notice at the beginning, which really wasted a lot of time. In summary, different installation methods differs from these aspects:

The Debian and RPM installations automatically install any dependencies, however, it:
requires sudo or root privileges to install
provides no flexibility as to which location TensorRT is installed into
requires that the CUDA Toolkit has also been installed using Debian or RPM packages.

The tar file provides more flexibility, however, you need to ensure that you have the necessary >dependencies already installed. For more information, see Tar File Installation.

The zip file is the only option currently for Windows. It does not support any other platforms besides >Windows. Ensure that you have the necessary dependencies already installed.

The third requirement of deb/rpm installation can be tricky and I was messed up for quite a while because of that. So be careful.

Finally I chose tar file to install TensorRT. It is simple to follow the official guide, just make sure you have downloaded the right tar file for your system and environment. But then I encountered some issue.

Issues occured to me

After completing the steps from the official guide, I found that the packages are not installed in my ~/anaconda3/lib/python3.6/site-packages. So when I try to do “import tensorrt as trt”, I got error like “module doesn’t exist”.

Then I found them in /usr/local/lib/python3.6/dist-packages . So I copy those package folders to ~/anaconda3/lib/python3.6/site-packages, by doing that, I can do “import tensorrt as trt”! (yea let’s call it can for now). Then another error occurs:“ImportError: libnvinfer.so.5: cannot open shared object file: No such file or directory”. To solve this, I found that libnvinfer.so.5 is on the directory ./TensorRT-5.0.2.6/targets/x86_64-linux-gnu/lib. Hence, simply copy those files using “sudo cp TensorRT-5.0.2.6/targets/x86_64-linux-gnu/lib/lib* /usr/lib/” solved that import error!

Now the tensorrt package works for me.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值