GeezerVison is showing github.com — Incompatible with CPP protobuf implementation for Python · Issue #2971 · googleapis/google-cloud-python
Incompatible with CPP protobuf implementation for Python #2971DescriptionHello,
I'm trying to use C++ protobuf implementation for Python since pure Python proto is too slow.
But importing gcloud.bigtable package throws an exception TypeError: Descriptors should not be created directly, but only retrieved from their parent..
Is there any way to fix this problem?
Thanks,
-
OS type and version
Tested on ubuntu 14.04 / osx 10.12.
-
Python version and virtual environment information python --version
Python 2.7.6
-
google-cloud-python version pip show google-cloud, pip show google-<service> or pip freeze
google-cloud 0.22.0 / 0.18.3
-
Stacktrace if available
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jungho.ahn/pyproto/protobuf/xx/local/lib/python2.7/site-packages/google/cloud/bigtable/__init__.py", line 18, in <module>
from google.cloud.bigtable.client import Client
File "/home/jungho.ahn/pyproto/protobuf/xx/local/lib/python2.7/site-packages/google/cloud/bigtable/client.py", line 33, in <module>
from google.longrunning import operations_grpc
File "/home/jungho.ahn/pyproto/protobuf/xx/local/lib/python2.7/site-packages/google/longrunning/operations_grpc.py", line 47, in <module>
options=None),
File "/home/jungho.ahn/pyproto/protobuf/python/google/protobuf/descriptor.py", line 494, in __new__
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors should not be created directly, but only retrieved from their parent.
- Steps to reproduce
// Install CPP proto implementation.
$ git clone https://github.com/google/protobuf.git
$ cd protobuf
$ ./autogen.sh
$ CXXFLAGS="-fPIC -g -O2" ./configure
$ make -j12
$ export PROTOC=$PWD/src/protoc
$ cd python
$ python setup.py bdist_wheel --cpp_implementation --compile_static_extension
$ pip uninstall protobuf
$ pip install dist/<wheel file name> (e.g., protobuf-3.2.0-cp27-cp27mu-linux_x86_64.whl)
// Enable CPP proto implementation.
$ export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
$ python -c 'from gcloud import bigtable'
- Code example
from gcloud import bigtable
Activitydhermes commented on Jan 28, 2017 @junghoahnsc Can you please try upgrading to google-cloud, the package moved from gcloud to google-cloud (a simple rename) after August 2016.
Unfortunately, I'm not sure the upgrade will fix the problem, but I want to make sure we're on the same page. junghoahnsc commented on Jan 28, 2017 Yes, actually I tried to upgrade to google-cloud 0.22.0, but it showed the same issue. tseaver commented on Jan 29, 2017 Note that the error is being raised from code in google.longrunning.operations_grpc, which is not maintained in this repository (it is auto-generated from the proto file), which means we won't be able to fix it here.
@bjwatson, @geigerj can you comment? dhermes commented on Jan 30, 2017 @tseaver The error is actually in protobuf itself. junghoahnsc commented on Jan 30, 2017 dhermes commented on Jan 30, 2017 lukesneeringer commented on Jan 31, 2017 I think you will need to file an issue there. I looked at the code and it's specifically nested within a if _USE_C_DESCRIPTORS:, and it is not obvious to me what it is supposed to be doing. Sorry. :-( dhermes commented on Feb 2, 2017 @junghoahnsc Closing out since we can't really offer help. Please post back here if you aren't able to resolve? changed the title [-][Bigtable] Incompatible with CPP protobuf implementation for Python[/-] [+]Incompatible with CPP protobuf implementation for Python[/+] on Feb 2, 2017lukesneeringer commented on Feb 28, 2017 added a commit that references this issue on Oct 21, 2023This issue will close once commit d95f563 is merged into the 'main' branch.d95f563
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|