ModuleNotFoundError: No module named 'tensorflow_core.estimator' for tensorflow 2.1.0

When using tensorflow, I have the following error messages

ERROR:root:Internal Python error in the inspect module. Below is the traceback from this internal error.' File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'tensorflow_core.estimator' 

The installed tensorflow related packages are shown as following. Do I need to update the estimator's version? If that's the case, how to install the estimator with right version?

enter image description here

1

7 Answers

TL;DR: Just solved this issue by making sure that both tensorflow and tensorflow-estimator were in the same version. (in my case, I needed to downgrade tensorflow-estimator, so conda install tensorflow-estimator=2.1.0 solved it for me)

As you may have noticed, some tensorflow versions do not play well with certain GPUs, so I would first check some of the available builds with conda search tensorflow; then I would make sure that the chosen tensorflow build can actually recognize my GPU (with tf.config.list_physical_devices('GPU')); finally, I would search for a matching tensorflow-estimator build with conda search tensorflow-estimator and only then install it with conda install tensorflow-estimator=<chosen version> -n <my_venv>.

It should be noted, however, that all these steps are mostly useful if you have interest in using your GPU. If that is not the case, than upgrading both packages (or downgrading/upgrading them so their versions match) may be the way.

1

You need to either downgrade your tensorflow-estimator or upgrade tensorflow in order for the versions to match. You can do the downgrading using

pip install tensorflow-estimator==2.1.0 
2

Try upgrading Tensorflow and Keras.

pip install tensorflow --upgrade pip install keras --upgrade 
4

I wish to leave here a few parameters on how I solved the issue.

For an assignment that I had to work with Python 3.7.10, I tried to solve the issue by downgrading tensorflow_core.estimator to 2.1.0, (same as tensorflow), from its previous version, (2.6.0), but it didn't worked.

The combination that finally worked for me is, (for python 3.7.10):

  • tensorflow_core.estimator = 2.6.0
  • tensorflow = 2.3.0
  • tensorflow_base = 2.3.0

In my case, it was on Google Colab when I tried to import tensorflow. The problem was due to the version 1.14, got fixed by installing 1.15 rather.

Another one here: In my case I accidentially import tensorflow.keras as K , while I should've import keras as K apparently they differ and I got that same error message. Hope I can save someone some time.

It is weird, but I had this problem because one string column wasn't converted to categorical variable.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like