_From @tianqig on September 13, 2017 12:1_
Just installed google-cloud (0.27.0) on my Mac OS X EI Capitan
Python 2.7
Anaconda
under a root env. when running: testLog.py
#Retrieve Datastore Entities
from google.cloud import datastore
client = datastore.Client()
product_key = client.key('Product', 123)
print(client.get(product_key))
Got following messages:
Traceback (most recent call last):
File "testLog.py", line 3, in <module>
from google.cloud import datastore
File "/Users/David/anaconda/lib/python2.7/site-packages/google/cloud/datastore/__init__.py", line 60, in <module>
from google.cloud.datastore.batch import Batch
File "/Users/David/anaconda/lib/python2.7/site-packages/google/cloud/datastore/batch.py", line 24, in <module>
from google.cloud.datastore import helpers
File "/Users/David/anaconda/lib/python2.7/site-packages/google/cloud/datastore/helpers.py", line 23, in <module>
from google.protobuf import struct_pb2
File "/Users/David/anaconda/lib/python2.7/site-packages/google/protobuf/struct_pb2.py", line 11, in <module>
from google.protobuf import descriptor_pb2
File "/Users/David/anaconda/lib/python2.7/site-packages/google/protobuf/descriptor_pb2.py", line 409, in <module>
options=None),
File "/Users/David/anaconda/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 501, in __new__
return _message.default_pool.FindFieldByName(full_name)
KeyError: "Couldn't find field google.protobuf.DescriptorProto.ExtensionRange.options"
Please help, thanks
_Copied from original issue: GoogleCloudPlatform/google-cloud-python#3948_
Hi @tianqig,
Thanks for reporting.
Could you try creating a virtualenv and installing _only_ protobuf, and see if from google.protobuf import descriptor_pb2 passes?
Also, this seems like it is probably an issue with protobuf itself, so I am going to move this issue over there.
Hi @lukesneeringer
thank you for quick help. just checked my installation, found three: (conda list)
protobuf 3.2.0
protobuf 3.3.2 py27_0 conda-forge
protobuf 3.4.0
Not sure why, should I uninstall them?
Thanks
You probably want to uninstall 3.2.0 and 3.3.2. ExtensionRange.options is only available from 3.4.0+.
Hi @lukesneeringer
Thank you for your message. The from google.protobuf import descriptor_pb2 doesn't work with my anaconda python 2.7. Following what @tianqig said, I have uninstalled protobuf 3.2.0 stuffs and 've kept only the protobuf 3.4.0. Problem is, in google/protobuf, the descriptor_pb2 file exists and it's still not working.
What should I do now ?
Thanks
Thu Nov 16 00:35:32 :~$ python
Python 3.6.2 |Anaconda custom (x86_64)| (default, Jul 20 2017, 13:14:59)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import tensorflow
Traceback (most recent call last):
File "", line 1, in
File "/Users/mona/anaconda/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in
from tensorflow.python import *
File "/Users/mona/anaconda/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 52, in
from tensorflow.core.framework.graph_pb2 import *
File "/Users/mona/anaconda/lib/python3.6/site-packages/tensorflow/core/framework/graph_pb2.py", line 10, in
from google.protobuf import descriptor_pb2
File "/Users/mona/anaconda/lib/python3.6/site-packages/google/protobuf/descriptor_pb2.py", line 409, in
options=None),
File "/Users/mona/anaconda/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.DescriptorProto.ExtensionRange.options"
from google.protobuf import descriptor_pb2
Traceback (most recent call last):
File "", line 1, in
File "/Users/mona/anaconda/lib/python3.6/site-packages/google/protobuf/descriptor_pb2.py", line 409, in
options=None),
File "/Users/mona/anaconda/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.DescriptorProto.ExtensionRange.options"
Downgrading protobuf via pip from 3.5.0 to 3.4.0 and tensorflow-gpu to 1.3.0 solved the problem for me.
@lukesneeringer TF is also running into this problem. However when I tried from google.protobuf import descriptor_pb2, it finishes successfully. So maybe some bad interaction with other packages in the system?
Most helpful comment
Downgrading
protobufvia pip from3.5.0to3.4.0andtensorflow-gputo1.3.0solved the problem for me.