AttributeError: module 'tensorflow.core.framework.types_pb2' has no attribute 'SerializedDType'

I was trying to import tensorflow in jupyter notebook, but I got the the error mentioned below, can you any one please solve this

AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_22244/638940694.py in
----> 1 import tensorflow as tf
2 from tensorflow.keras import models, layers
3 import matplotlib.pyplot as plt
4 from IPython.display import HTML

~\anaconda3\lib\site-packages\tensorflow_init_.py in
47 _tf2.enable()
48
—> 49 from ._api.v2 import internal
50 from ._api.v2 import operators
51 from ._api.v2 import audio

~\anaconda3\lib\site-packages\tensorflow_api\v2_internal__init_.py in
8 import sys as _sys
9
—> 10 from . import autograph
11 from . import decorator
12 from . import dispatch

~\anaconda3\lib\site-packages\tensorflow_api\v2_internal_\autograph_init_.py in
8 import sys as _sys
9
—> 10 from tensorflow.python.autograph.core.ag_ctx import control_status_ctx
11 from tensorflow.python.autograph.impl.api import tf_convert
12

~\anaconda3\lib\site-packages\tensorflow\python\autograph\core\ag_ctx.py in
19 import threading
20
—> 21 from tensorflow.python.autograph.utils import ag_logging
22 from tensorflow.python.util.tf_export import tf_export
23

~\anaconda3\lib\site-packages\tensorflow\python\autograph\utils_init_.py in
15 “”“Utility module that contains APIs usable in the generated code.”“”
16
—> 17 from tensorflow.python.autograph.utils.context_managers import control_dependency_on_returns
18 from tensorflow.python.autograph.utils.misc import alias_tensors
19 from tensorflow.python.autograph.utils.tensor_list import dynamic_list_append

~\anaconda3\lib\site-packages\tensorflow\python\autograph\utils\context_managers.py in
17 import contextlib
18
—> 19 from tensorflow.python.framework import ops
20 from tensorflow.python.ops import tensor_array_ops
21

~\anaconda3\lib\site-packages\tensorflow\python\framework\ops.py in
48 from tensorflow.python import tf2
49 from tensorflow.python.client import pywrap_tf_session
—> 50 from tensorflow.python.eager import context
51 from tensorflow.python.eager import core
52 from tensorflow.python.eager import monitoring

~\anaconda3\lib\site-packages\tensorflow\python\eager\context.py in
35 from tensorflow.python.client import pywrap_tf_session
36 from tensorflow.python.eager import cancellation
—> 37 from tensorflow.python.eager import execute
38 from tensorflow.python.eager import executor
39 from tensorflow.python.eager import monitoring

~\anaconda3\lib\site-packages\tensorflow\python\eager\execute.py in
19 from tensorflow.python import pywrap_tfe
20 from tensorflow.python.eager import core
—> 21 from tensorflow.python.framework import dtypes
22 from tensorflow.python.framework import tensor_conversion_registry
23 from tensorflow.python.framework import tensor_shape

~\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py in
50
51 @tf_export(“dtypes.DType”, “DType”)
—> 52 class DType(
53 _dtypes.DType,
54 trace.TraceType,

~\anaconda3\lib\site-packages\tensorflow\python\framework\dtypes.py in DType()
249
250 @classmethod
→ 251 def experimental_type_proto(cls) → Type[types_pb2.SerializedDType]:
252 “”“Returns the type of proto associated with DType serialization.”“”
253 return types_pb2.SerializedDType

AttributeError: module ‘tensorflow.core.framework.types_pb2’ has no attribute ‘SerializedDType’

Hi @Tarun_Damarla, I think the tensorflow installation did not happen properly. Could you please try to create a new environment and install Tensorflow using pip. Thank You.