Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import tensorflow hub #819

Closed
Bannigo opened this issue Oct 31, 2021 · 10 comments · Fixed by IBM/UQ360#20
Closed

Cannot import tensorflow hub #819

Bannigo opened this issue Oct 31, 2021 · 10 comments · Fixed by IBM/UQ360#20

Comments

@Bannigo
Copy link

Bannigo commented Oct 31, 2021

Hello Guys,

I am facing an issue regarding the import of TensorFlow hub. Following are the errors which are posted in the terminal. The version of tensorflow, I am using is 2.6, and the version of tensorflow-hub is 0.12.0. I installed both of them using pip install. I have a bit of urgency in completing my project, and I would be really thankful for your help.

File "/home/bannigo/catkin_ws/src/motorAI_assign/scripts/task1_1.py", line 21, in
import tensorflow_hub as hub
File "/home/bannigo/.local/lib/python3.6/site-packages/tensorflow_hub/init.py", line 88, in
from tensorflow_hub.estimator import LatestModuleExporter
File "/home/bannigo/.local/lib/python3.6/site-packages/tensorflow_hub/estimator.py", line 62, in
class LatestModuleExporter(tf.compat.v1.estimator.Exporter):
File "/home/bannigo/.local/lib/python3.6/site-packages/tensorflow/python/util/lazy_loader.py", line 62, in getattr
module = self._load()
File "/home/bannigo/.local/lib/python3.6/site-packages/tensorflow/python/util/lazy_loader.py", line 45, in _load
module = importlib.import_module(self.name)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/bannigo/.local/lib/python3.6/site-packages/tensorflow_estimator/init.py", line 10, in
from tensorflow_estimator._api.v1 import estimator
File "/home/bannigo/.local/lib/python3.6/site-packages/tensorflow_estimator/_api/v1/estimator/init.py", line 10, in
from tensorflow_estimator._api.v1.estimator import experimental
File "/home/bannigo/.local/lib/python3.6/site-packages/tensorflow_estimator/_api/v1/estimator/experimental/init.py", line 10, in
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
File "/home/bannigo/.local/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/canned/dnn.py", line 27, in
from tensorflow_estimator.python.estimator import estimator
File "/home/bannigo/.local/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 70, in
@doc_controls.inheritable_header("""
AttributeError: module 'tensorflow.tools.docs.doc_controls' has no attribute 'inheritable_header'

@ZheZhang10
Copy link

I got exact same problem. I'm looking for help.
Python 3.79
tensorflow: 2.6
tensorflow_hub: 0.12

@SageRalph
Copy link

SageRalph commented Oct 31, 2021

Same problem.

Python 3.9.2
pip 21.2.4
tensorflow 2.6.0
tensorflow_hub 0.12.0

Also occurs when using the docker image tensorflow/tensorflow:latest if tensorflow is updated to 2.6.0.

Also occurs when using tensorflow_hub 0.11.0.

Works fine with tensorflow 2.5.1 in both environments

@ZheZhang10
Copy link

I reinstalled tensorflow, tensorflow_hub, degraded to tensorflow 2.5.0 , tensorflow_hub 0.12.0. The problem disappeared.

@WGierke
Copy link
Collaborator

WGierke commented Nov 1, 2021

The TF team is currently working on a fix. In the meantime, please try downgrading tensorflow-estimator:

pip install -U tensorflow-estimator==2.6.0

@UsharaniPagadala
Copy link

@Bannigo

Could you respond to the above comment by @WGierke
also please refer to the similar issue, and let us know if this helps.Thanks

@FindTheConstraint
Copy link

pip install -U tensorflow-estimator==2.6.0

This is now giving the error: AlreadyExistsError: Another metric with the same name already exists.

@WGierke
Copy link
Collaborator

WGierke commented Nov 5, 2021

Please try downgrading keras:

pip install -U keras==2.6.0

The TF team just released v2.7.0 (https://pypi.org/project/tensorflow/). In preparation for that, other libraries had to release their new versions 2.7.0 first (tensorflow-estimator, keras, ...). It occasionally happened that when installing TF 2.6, some dependencies were installed with their new version 2.7.0. This led to issues since the combination of TF 2.6 and version 2.7 of these libraries is not compatible. @FindTheConstraint please tell us whether downgrading keras helped.

@Bannigo
Copy link
Author

Bannigo commented Nov 5, 2021

Hi everyone,
Thank you so much for your inputs. I had to go offline due to a few circumstances. But the solution works now. I have downgraded TensorFlow.

pronics2004 added a commit to IBM/UQ360 that referenced this issue Nov 5, 2021
restricting TensorFlow to 2.5 or below while this issue is being fixed tensorflow/hub#819.
@UsharaniPagadala
Copy link

@Bannigo
Closing this issue as it is resolved.Please feel free to reopen if this still exists.Thanks

pronics2004 added a commit to pronics2004/UQ360 that referenced this issue Oct 17, 2022
restricting TensorFlow to 2.5 or below while this issue is being fixed tensorflow/hub#819.

Signed-off-by: Prasanna Sattigeri <pronics2004@gmail.com>
@farhaddubey
Copy link

!pip install --upgrade tensorflow-hub
In jupyter notebook it worked.
Either downgrade the tensorflow or upgrade the tensorflow-hub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants