Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to use tensorflow in my code But I am facing following error ModuleNotFoundError: No module named ‘tensorflow.python.saved_model.model_utils’ in Python. So Here I am Explain to you all the possible solutions here.
Without wasting your time, Let’s start This Article to Solve This Error.
How this Error Occurs ?
I am trying to use tensorflow in my code But I am facing following 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’
How To Solve ModuleNotFoundError: No module named ‘tensorflow.python.saved_model.model_utils’ Error ?
- How To Solve ModuleNotFoundError: No module named 'tensorflow.python.saved_model.model_utils' Error ?
To Solve ModuleNotFoundError: No module named 'tensorflow.python.saved_model.model_utils' Error Here issue is Currently the default install of tensorflow is 2.x while your code is for 1.x. The contrib module has been removed from tf 2.x. Check the warnings. The TensorFlow contrib module will not be included in TensorFlow 2.0. Just Uninstall tensorflow and then install the 1.x version with this command: pip install tensorflow==1.15 Second solution is To use slim you need to install tf_slim use this command to install tf_slim: pip install –upgrade tf_slim And then Use in this way import tf_slim as slim Now your error must be solved.
- ModuleNotFoundError: No module named 'tensorflow.python.saved_model.model_utils'
To Solve ModuleNotFoundError: No module named 'tensorflow.python.saved_model.model_utils' Error Here issue is Currently the default install of tensorflow is 2.x while your code is for 1.x. The contrib module has been removed from tf 2.x. Check the warnings. The TensorFlow contrib module will not be included in TensorFlow 2.0. Just Uninstall tensorflow and then install the 1.x version with this command: pip install tensorflow==1.15 Second solution is To use slim you need to install tf_slim use this command to install tf_slim: pip install –upgrade tf_slim And then Use in this way import tf_slim as slim Now your error must be solved.
Solution 1: Downgrade tensorflow 2.X to 1.X
Here issue is Currently the default install of tensorflow is 2.x while your code is for 1.x. The contrib module has been removed from tf 2.x. Check the warnings.
The TensorFlow contrib module will not be included in TensorFlow 2.0.
Just Uninstall tensorflow and then install the 1.x version with this command.
pip install tensorflow==1.15
Solution 2: install tf_slim
To use slim you need to install tf_slim use this command to install tf_slim.
pip install --upgrade tf_slim
And then Use in this way.
import tf_slim as slim
Summary
It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also, Read