tensorflow: Couldn't find field google.protobuf.EnumDescriptorProto.EnumReservedRange.start

Im trying to run the following code

import tensorflow as tf

print("Hello TensorFlow version", tf.__Version__)

It is firing the following error

Users/anaconda/envs/cnn/bin/python /Users/Downloads/rude-carnie/version.py Traceback (most recent call last): File “/Users/Downloads/rude-carnie/version.py”, line 1, in <module> import tensorflow as tf File “/Users/anaconda/envs/cnn/lib/python3.6/site-packages/tensorflow/init.py”, line 24, in <module> from tensorflow.python import * File “/Users/anaconda/envs/cnn/lib/python3.6/site-packages/tensorflow/python/init.py”, line 52, in <module> from tensorflow.core.framework.graph_pb2 import * File “/Users/anaconda/envs/cnn/lib/python3.6/site-packages/tensorflow/core/framework/graph_pb2.py”, line 10, in <module> from google.protobuf import descriptor_pb2 File “/Users/anaconda/envs/cnn/lib/python3.6/site-packages/google/protobuf/descriptor_pb2.py”, line 735, in <module> options=None, file=DESCRIPTOR), File “/Users/anaconda/envs/cnn/lib/python3.6/site-packages/google/protobuf/descriptor.py”, line 501, in new return _message.default_pool.FindFieldByName(full_name) KeyError: “Couldn’t find field google.protobuf.EnumDescriptorProto.EnumReservedRange.start”

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (3 by maintainers)

Most upvoted comments

I find this solution really helpful:

  1. uninstall all the protobuf on your machine (both from anaconda and pip) pip uninstall protobuf conda remove protobuf you may try them twice to make sure all the version of protobuf have been removed
  2. install protobuf using pip: pip install protobuf==3.5.0.post1

OK, here is the solution – funny but worked for me 👯‍♂️

I uninstalled protobuf 3.5.0.post1, which comes with TF 1.4.1 distro, installed 3.4.0 release and then installed 3.5.0.post1.

deeplearn@Ubuntu-1604-xenial-64-minimal:~$ pip install protobuf==3.4.0
Requirement already satisfied: protobuf==3.4.0 in ./anaconda3/lib/python3.6/site-packages
Requirement already satisfied: setuptools in ./anaconda3/lib/python3.6/site-packages (from protobuf==3.4.0)
Requirement already satisfied: six>=1.9 in ./anaconda3/lib/python3.6/site-packages (from protobuf==3.4.0)
deeplearn@Ubuntu-1604-xenial-64-minimal:~$ pip install protobuf==3.5.0.post1
Collecting protobuf==3.5.0.post1
  Using cached protobuf-3.5.0.post1-py2.py3-none-any.whl
Requirement already satisfied: six>=1.9 in ./anaconda3/lib/python3.6/site-packages (from protobuf==3.5.0.post1)
Requirement already satisfied: setuptools in ./anaconda3/lib/python3.6/site-packages (from protobuf==3.5.0.post1)
Installing collected packages: protobuf
  Found existing installation: protobuf 3.4.0
    Uninstalling protobuf-3.4.0:
      Successfully uninstalled protobuf-3.4.0
Successfully installed protobuf-3.5.0.post1
deeplearn@Ubuntu-1604-xenial-64-minimal:~$ 

as a result, this baby’s working 😃

screen shot 2017-11-23 at 23 42 32

Maybe you’ve tried tf-nightly or something? Anyway, try reinstalling the protobuf version that TensorFlow 1.4 wants by running:

pip uninstall protobuf
pip install tensorflow
python -c "import tensorflow"

came with the same issue, I solved it with these commands:

conda remove protobuf
pip install tensorflow=1.4.0
pip install protobuf==3.4.0
pip install protobuf==3.5.0.post1
python -c "import tensorflow"

thanks @gokceneraslan and @TarrySingh

Thanks @TarrySingh, pip install protobuf==3.4.0 solved the problem!

In my case tf 1.4.1 works only with protobuf 3.4.0:

python -c "import tensorflow as tf; print(tf.__version__); import google.protobuf as pb; print(pb.__version__)"
1.4.1
3.4.0

Upgrading protobuf to 3.5.x results in KeyError: "Couldn't find field google.protobuf.EnumDescriptorProto.EnumReservedRange.start"

check if your protobuf are installed deplicately like:

  • sudo apt-get install python3-protobuf or python-protobuf
  • pip install protobuf or pip3 install protobuf

If both installed, uninstall one of them

1、remove all the protobuf, by pip list, conda list and so on 2、install a new one

@TarrySingh didn’t immediately help but upgrading all pip packages did:

pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U

Hope it helps.

I tried all… i tried reinstalling protobuf, tensorflow but still the same issue 😦