Issue with tensorflow.contrib.tensorrt

I have downloaded tensorflow-gpu with pip version 9 and have downloaded tensorRT following exact nvidia instructions.
Now I am trying to run the code for resnet 50 found here:

https://devblogs.nvidia.com/tensorrt-integration-speeds-tensorflow-inference/

I get the error:
import tensorflow.contrib.tensorrt
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named tensorrt

I am running python 2 and the cuda version that I have is 9.
I ran the command in python:

import tensorrt

and that works.
I am confused on whether this is an issue with the installation of tensorRT or it is tensorflow specific.

“import tensorrt” imports python bindings for tensorrt not tftrt. In order to be able to import tensorflow.contrib.tensorrt, you need to have at least tensorflow-gpu version 1.7 installed in the system and tensorrt libraries must be available to the process, either through LD_LIBRARY_PATH or ldconfig.

HI @nowrker,

Sorry for the late response.I had the same issue and all I did was to install a newer version of Tensorflow. It seems that older tensorflow version 1.5 was causing the error for importing “tensorflow.contrib.tensorrt as trt”

Please see below;

import tensorflow.contrib.tensorrt as trt
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named ‘tensorflow’

HENCE I UPDATED THE TENSORFLOW VERSION TO 1.9 USING THE SINGLE LINE OF CODE IN THE UBUNTU TERMINAL;

pip install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp33 tensorflow-gpu

When I executed the above, it started downloading and installing later(but not the latest) versions of tensorflow and some python API dependencies.

THE ABOVE WORKED FOR ME AND HOPE IT WORKS OUT FOR YOU TOO.

Regards
Sri