I found a chatbot program in github and wanted to run this program for my better understanding. But every time I try to run this program, it says
No module named 'tensorflow.contrib'
What should I do to fix this error?
The Python "ModuleNotFoundError: No module named 'tensorflow'" occurs when we forget to install the tensorflow module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install tensorflow command.
TensorFlow's high-level machine learning API (tf. contrib. learn) makes it easy to configure, train, and evaluate a variety of machine learning models.
contrib was removed in version 1.14 or 1.15.
Probably the code you found was written in TensorFlow 1.x, but you have TensorFlow 2.x installed. Instead of downgrading TensorFlow, the compatibility module can be used:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
Source:https://www.tensorflow.org/guide/migrate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With