Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 573
user297850 Avatar asked Feb 03 '21 06:02

user297850


2 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.

like image 155
willfliaw Avatar answered Oct 07 '22 23:10

willfliaw


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
like image 7
Marzi Heidari Avatar answered Oct 07 '22 22:10

Marzi Heidari