HAO CHEN
HAO CHEN

Reputation: 1319

how to solve the no 'estimator' in tensorflow?

I am trying to implement a code from tensorflow:

https://colab.research.google.com/github/tensorflow/hub/blob/master/examples/colab/semantic_similarity_with_tf_hub_universal_encoder.ipynb

However, I had the error of tensorflow lib as follows, I have tried uninstall and reinstall the tensorflow but no working, is anyone facing this error before?

  import tensorflow as tf
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/tensorflow/__init__.py", line 22, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/tensorflow/core/framework/graph_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/google/protobuf/__init__.py", line 37, in <module>
    __import__('pkg_resources').declare_namespace(__name__)
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3112, in <module>
    @_call_aside
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3096, in _call_aside
    f(*args, **kwargs)
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3140, in _initialize_master_working_set
    for dist in working_set
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3140, in <genexpr>
    for dist in working_set
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2647, in activate
    declare_namespace(pkg)
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2184, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2117, in _handle_ns
    loader.load_module(packageName)
  File "/data/d14127800/dataset10/google.py", line 4, in <module>
    import tensorflow_hub as hub
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/tensorflow_hub/__init__.py", line 23, in <module>
    from tensorflow_hub.estimator import LatestModuleExporter
  File "/data/d14127800/py3_170/lib/python3.5/site-packages/tensorflow_hub/estimator.py", line 61, in <module>
    class LatestModuleExporter(tf.estimator.Exporter):
AttributeError: module 'tensorflow' has no attribute 'estimator'

Upvotes: 0

Views: 7055

Answers (3)

shuvo
shuvo

Reputation: 1956

I changed the tensorflow-estimator to 1.10.12 by doing pip install tensorflow-estimator==1.10.12 and it resolved the issue.

Upvotes: 1

Mickey Mouse
Mickey Mouse

Reputation: 55

I also face similar error but it was in Darkflow After doing much google nothing worked for me and did many attempt to resolve it But I came out with solution just by doing

for Anaconda ->conda install matplotlib ->conda install pandas (It should be updated Version of Both) After doing this ReStart Your NoteBook

For Normal IDLE ->pip install pandas ->pip install matplotlib

Upvotes: 1

Olivier Dehaene
Olivier Dehaene

Reputation: 1680

Estimator was moved from tf.contrib.learn.Estimator to tf.estimator.Estimator with the TF 1.1.0 release. Make sure that your Tensorflow version is higher using:

pip show tensorflow

or

pip show tensorflow-gpu 

if you are using the GPU version.

If it is lower, you can update Tensorflow with:

pip install --upgrade tensorflow

or

pip isntall --upgrade tensorflow-gpu

or use tf.contrib.learn.Estimator instead.

Upvotes: 0

Related Questions