. Advertisement .
..3..
. Advertisement .
..4..
One of the common problems that developers face when working with Android devices is the error “ModuleNotFoundError: No module named ‘tensorflow.python.saved_model.model_utils’” . This problem can usually be solved by changing the AVD configuration or upgrading the device driver. This blog will help you to fix this issue.
When Do You Get The Error “ModuleNotFoundError: No module named ‘tensorflow.python.saved_model.model_utils’”?
When incorporating Tensorflow into your code, you may encounter the 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’
The problem is that the default tensorflow installation is 2.x, while your code is for 1.x. Tf 2.x no longer includes the contrib module. Look over the warnings. TensorFlow 2.0 will not include the TensorFlow contrib module. Simply remove tensorflow and then run pip install tensorflow==1.15 to install the 1.x version. The slim option is the second option. You must install tf slim using the command pip install –upgrade tf slim. Next, utilize import tf slim as slim in this way. Now, you have fixed your issue.
How To Handle The Error “ModuleNotFoundError: No module named ‘tensorflow.python.saved_model.model_utils’”?
Option 1: Revert to Tensorflow 1.X.
The problem is as follows: Tensorflow 2.x is currently installed by default, but your code is for 1.x. Tf 2.x no longer includes the contrib module. Look over the warnings.
TensorFlow 2.0 will not include the TensorFlow contrib module.
Simply remove tensorflow, then run this command to install the 1.x version.
pip install tensorflow==1.15
Option 2: Install tf_slim
To utilize slim, you must first install the tf slim package. To install tf slim, run this command.
pip install --upgrade tf_slim
Then, apply it in this way.
import tf_slim as slim
Option 3: Uninstall and reinstall the tensorflow-estimator package
A high-level TensorFlow API called TensorFlow Estimator makes machine learning programming a lot easier. For your model, estimators incorporate training, assessment, forecasting, and exporting.
Excepting two options mentioned above, there is another option for you to solve the error “ModuleNotFoundError: No module named ‘tensorflow.python.saved_model.model_utils’”. If you uninstall and reinstall the tensorflow-estimator package, you should be able to get around this. Let’s do as the following command:
pip uninstall tensorflow_estimator
pip install tensorflow_estimator
Conclusion
We hope you will enjoy our article about this confusing error. With this knowledge, we know that you can fix your “ModuleNotFoundError: No module named ‘tensorflow.python.saved_model.model_utils’” problem in Windows quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Read more
→ How to Fix The ModuleNotFoundError: No Module Named ‘Requests’ in Python? – A Complete Guide
Leave a comment