No module named 'tensorflow.contrib'

Have spent a couple days troubleshooting. This is the complete installation guide for a course I am taking

When I try and enter the following in cmd

$python --camera video.mp4

I get the following error

ModuleNotFoundError: No module named 'tensorflow.contrib'

The offending line is

import tensorflow.contrib.tensorrt as trt

Here are my setup specs

  • Windows 10

    Python 3.6.8

    CUDA 10.0

    cuDNN v 7.6.2

    Tensorflow (gpu) 1.14.0

    GeForce GTX 960M

    Driver version 431.60

    Intel Core i7-6700HQ 2.6 GHz*

Any feedback or troubleshooting steps appreciated!

Is it possible tensorflow is in correctly installed? When I do a $pip list I get

tensorflow 1.14.0
tensorflow-estimator 1.14.0
tensorflow-gpu 2.0.0b1

I get almost identical error if instead of cmd I run using Anaconda prompt with Python 3.7.3 “No module named 'tensorflow.python.compiler.”

Also confirmed that import tensorflow DOES work in a Python shell.

So bottom line is that the tensorRT module is missing. Then how to install? A quick google shows no Windows installer or support? I already tried uninstalling then reinstalling tensorflow and tensorflow-gpu

Finally works but getting 1 frame every 2-4 seconds with canned 1080p video!

here are my specs

hardware + driver

GeForce GTX 960M
Driver version 431.60
Intel Core i7 6700HQ CPU 2.6 GHz
15.87 GB RAM

Windows 10
CUDA 10.0
Python 3.6.8
tensorflow 1.14.0


  1. I had to comment out the line

import tensorflow.contrib.tensoort as trt

to avoid compile errors.

Could this be causing my performance issues?

  1. I have both tensorflow and tensorflow-gpu installed. How do I know which one I am running?

  2. What other steps should I take to help troubleshoot performance?

Hello batch44

I had same issue and my working environment seems to me same like yours(os, python, package version…etc)

Did you get any answer yet? if you did, let us know, thank you!

Hey I have the same problem I followed this tutorial

how did you solve it?


thanks for the solution… @consistant1y, just remove that line “import tensorflow.contrib.tensoort as trt” from file