ModuleNotFoundError: No module named 'tensorflow.contrib' code example

Example 1: import tensorflow as tf ModuleNotFoundError: No module named 'tensorflow'

conda create -n tensorflow python=3.5
activate tensorflow
pip install --ignore-installed --upgrade tensorflow

Example 2: ModuleNotFoundError: No module named 'tensorflow_addons'

pip install tensorflow-addons

Example 3: ModuleNotFoundError: No module named 'tensorflow.contrib' site:stackoverflow.com

import tensorflow.contrib.eager as tfe

Example 4: ImportError: No module named tensorflow

#if you are using bert its only comaptible with python 2.7/pip2 
#and tensorflow 1.15.0 so you need to install like so
pip2 install tensorflow==1.15.0 --ignore-installed

#also if you have a gpu 
pip2 install tensorflow-gpu==1.15.0 --ignore-installed

Tags:

Misc Example