Hi I just installed Tensorflow
on my Mac and I want to use tf.contrib.slim
but when I use it I get this
import tensorflow as tf
slim = tf.contrib.slim
Error:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/export/export_lib.py", line 25, in from tensorflow.python.saved_model.model_utils import build_all_signature_defs ModuleNotFoundError: No module named 'tensorflow.python.saved_model.model_utils'
I don't know what to do, please help me
I use Tensorflow.13.1
and python 3.7
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.
contrib was removed in version 1.14 or 1.15.
In general, tf. contrib contains contributed code. It is meant to contain features and contributions that eventually should get merged into core TensorFlow, but whose interfaces may still change, or which require some testing to see whether they can find broader acceptance.
For anyone who is trying some old codes from github with Tensorflow 1.x.x
versions while having Tensorflow 2.0.x
please note that tf.contrib
no longer exist in Tensorflow 2.0.x
and it's modules were moved.
Please google the name of the module without the tf.contrib
part to know it's new location and thus migrating your code accordingly by correcting the import
statement.
Hope this helped!
first unistall tensorflow
pip uninstall tensorflow
then install 1.13.2 version
pip install tensorflow==1.13.2
it works.. had the same issue.. but installing tensorflow 1.13.2 solved it!
the newer version of tensorflow doesn't have
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