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:
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.
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;