Reputation: 143
I keep getting this error when importing tensorflow as tf with the below error text:
ImportError: cannot import name 'export_saved_model' from 'tensorflow.python.keras.saving.saved_model'
Code used is simply:
import tensorflow as tf
I have done:
Code used for tensorflow unstallation:
pip uninstall tensorflow
or conda uninstall -y tensorflow
Code used for tensorflow installation:
pip install tensorflow
or conda install tensorflow
I can't seem to figure why it keeps saying:
"ImportError: cannot import name 'export_saved_model' from 'tensorflow.python.keras.saving.saved_model'"
Upvotes: 10
Views: 26978
Reputation: 939
The error went away when I restarted my jupyter notebook and restarted my kernel.
Upvotes: 0
Reputation: 1
I tried uninstalling several times but it didn't work. Finally i got the solution.
Uninstall tensorflow using pip and conda Uninstall Keras also
conda uninstall -y tensorflow
pip uninstall tensorflow
pip uninstall keras
Now open the anaconda prompt, install tensorflow again
conda create -n tf tensorflow
conda activate tf
I think the issue was due to library dependencies with older versions of tensorflow. Above procedure worked for me .
Upvotes: 0
Reputation: 98
Uninstalling and install again worked for me.
conda activate tf
pip uninstall -y tensorflow-gpu
pip install tensorflow-gpu
However, am still looking for the cause of this error. It was working just a few minutes ago but suddenly I have faced this error.
Upvotes: 2