"import tensorflow" results in error: No module named 'tensorflow.python.eager.polymorphic_function' (Python in Jupyter Lab)

Question:

Python 3.9.12.
Windows 10.
jupyterlab 3.3.2.

Import tensorflow

When I try to import Tensorflow, I get the following ‘tensorflow.python.eager.polymorphic_function’ error.

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In [44], line 1
----> 1 import tensorflow

File ~OD13TFODCoursetfod13libsite-packagestensorflow__init__.py:45
     42 from tensorflow.python import tf2 as _tf2
     43 _tf2.enable()
---> 45 from ._api.v2 import __internal__
     46 from ._api.v2 import __operators__
     47 from ._api.v2 import audio

File ~OD13TFODCoursetfod13libsite-packagestensorflow_apiv2__internal____init__.py:14
     12 from . import eager_context
     13 from . import feature_column
---> 14 from . import function
     15 from . import graph_util
     16 from . import mixed_precision

File ~OD13TFODCoursetfod13libsite-packagestensorflow_apiv2__internal__function__init__.py:8
      3 """Public API for tf.__internal__.function namespace.
      4 """
      6 import sys as _sys
----> 8 from tensorflow.python.eager.polymorphic_function.polymorphic_function import Function
      9 from tensorflow.python.eager.polymorphic_function.quarantine import defun_with_attributes

ModuleNotFoundError: No module named 'tensorflow.python.eager.polymorphic_function'

My workflow is based on this tutorial: https://www.youtube.com/watch?v=yqkISICHH-U

I found the following answer, but I’m not understanding how to implement the TFLite Authoring Tool to solve this problem:
https://stackoverflow.com/questions/74177865/tensorflow-python-eager-polymorphic-function-no-module-error-on-imports

Asked By: Tom

||

Answers: