TensorRT won't install under CUDA 10.1

I am trying to install TensorRT GA for Ubuntu 1804 and CUDA 10.0 DEB local repo packages with my CUDA 10.1 installation. I get this error:

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 resolve the situation:

The following packages have unmet dependencies:
 tensorrt : Depends: libnvinfer5 (= 5.0.2-1+cuda10.0) but it is not going to be installed
            Depends: libnvinfer-dev (= 5.0.2-1+cuda10.0) but it is not going to be installed
            Depends: libnvinfer-samples (= 5.0.2-1+cuda10.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

The package seems to have dependencies to CUDA 10.0 which is expected but is there anyway to force install TensorRT by bypassing the requirement check.

Thank you

Instead of force install, please consider using NVIDIA GPU Cloud (NGC) TensorRT docker container, which has minimal host-side dependencies. https://www.nvidia.com/en-us/gpu-cloud/


I had the same issue while trying to install tensorrt from tensorflow https://www.tensorflow.org/install/gpu on the nvidia cuda docker nvidia/cuda:10.0-devel-ubuntu18.04. Following resolves this issue (most important is to hold the libcudnn and cuda packages and install libninfer5 before libinfer-dev):

apt-mark hold libcudnn7
apt-mark hold cuda*

apt-get install -y nvinfer-runtime-trt-repo-ubuntu1804-5.0.2-ga-cuda10.0
apt-get update
apt-get install -y --no-install-recommends libnvinfer5=5.0.2-1+cuda10.0
apt-get install -y --no-install-recommends libnvinfer-dev=5.0.2-1+cuda10.0

In my case, removing and reinstalling libcudnn7 worked. There seems to be a libcudnn7 package that comes with tensorrt and there was some sort of conflict with an existing one - I think. I know as little about dpkg and apt as possible.