Install TensorRT
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.