Getting TypeError: expected bytes, Descriptor found while importing tensorflow I am trying to use tensorflow and keras for one of the tasks but while importing the tensorflow I am getting the below error. Till now I have removed the virtual which I have created previously and then created the new virtual environment again, but still I am getting the same error. Any leads would be appreciated. Here is the command below which I am running.

import tensorflow as tf


Here is the error I am getting

runfile('C:/Users/Lenovo/.spyder-py3/temp.py', wdir='C:/Users/Lenovo/.spyder-py3')
Traceback (most recent call last):

  File "C:\Users\Lenovo\.spyder-py3\temp.py", line 1, in &lt;module&gt;
    import tensorflow as tf


File "C:\Users\Lenovo\Anaconda3\envs\myenv\lib\site-packages\tensorflow__init__.py", line 28, in 
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import

  File "C:\Users\Lenovo\Anaconda3\envs\myenv\lib\site-packages\tensorflow\python\__init__.py", line 52, in &lt;module&gt;
    from tensorflow.core.framework.graph_pb2 import *

  File "C:\Users\Lenovo\Anaconda3\envs\myenv\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 16, in &lt;module&gt;
    from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2

      File "C:\Users\Lenovo\Anaconda3\envs\myenv\lib\site-packages\tensorflow\core\framework\node_def_pb2.py", line 16, in &lt;module&gt;
    from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2

  File "C:\Users\Lenovo\Anaconda3\envs\myenv\lib\site-packages\tensorflow\core\framework\attr_value_pb2.py", line 16, in &lt;module&gt;
   from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2

  File "C:\Users\Lenovo\Anaconda3\envs\myenv\lib\site-packages\tensorflow\core\framework\tensor_pb2.py", line 16, in &lt;module&gt;
   from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2

  File "C:\Users\Lenovo\Anaconda3\envs\myenv\lib\site-packages\tensorflow\core\framework\resource_handle_pb2.py", line 92, in &lt;module&gt;
__module__ = 'tensorflow.core.framework.resource_handle_pb2'

TypeError: expected bytes, Descriptor found


Below is the configuration of my system.

(myenv) C:\Users\Lenovo&gt;conda list tensorflow
# packages in environment at C:\Users\Lenovo\Anaconda3\envs\myenv:
#
# Name                    Version                   Build  Channel
tensorflow                1.14.0                   pypi_0    pypi
tensorflow-estimator      1.14.0                   pypi_0    pypi

(myenv) C:\Users\Lenovo&gt;conda list keras
# packages in environment at C:\Users\Lenovo\Anaconda3\envs\myenv:
#
# Name                    Version                   Build  Channel
keras-applications        1.0.8                    pypi_0    pypi
keras-preprocessing       1.1.0                    pypi_0    pypi

(myenv) C:\Users\Lenovo&gt;
I resolved the issue by creating new environment with tensorflow by the below two commands:

conda create -n tensorflow_env tensorflow
conda activate tensorflow_env