ImportError: cannot import name 'GceClusterResolver'

1.6k Views Asked by At

I am following the guide for installing TensorFlow Slim, and I faced this error.

ImportError: cannot import name 'GceClusterResolver'

I searched online and found some questions on Stack Overflow regarding "import error cannot import name xxx", but none of them is the same as mine. I've tried their solutions too but they didn't work.

This is the complete error message. Any help is greatly appreciated.

python -c "import tensorflow.contrib.slim as slim; eval = slim.evaluation.evaluate_once"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/__init__.py", line 31, in <module>
    from tensorflow.contrib import cluster_resolver
  File "/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/cluster_resolver/__init__.py", line 26, in <module>
    from tensorflow.python.distribute.cluster_resolver.gce_cluster_resolver import GceClusterResolver
ImportError: cannot import name 'GceClusterResolver'
1

There are 1 best solutions below

0
Juan David Ramirez Villegas On

I found out that i was using tflearn with tensorflow 2 but tflearn is not compatible with tensorflow 2. I just falled back to a tensorflow 1 version.

# uninstall both libs
pip uninstall tensorflow
pip uninstall tflearn

# install the compatible version
pip install tflearn
pip install tensorflow==1.15