GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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 #2971

New issue
Copy link
New issue
Copy link
Closed
Closed
Incompatible with CPP protobuf implementation for Python#2971
Copy link
Assignees
dhermes
Labels
packaging

Description

@junghoahnsc
junghoahnsc
opened on Jan 28, 2017
Issue body actions

Hello,

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,

  1. OS type and version
    Tested on ubuntu 14.04 / osx 10.12.

  2. Python version and virtual environment information python --version
    Python 2.7.6

  3. google-cloud-python version pip show google-cloud, pip show google-<service> or pip freeze
    google-cloud 0.22.0 / 0.18.3

  4. 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.
  1. 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'
  1. Code example
    from gcloud import bigtable

Activity

  1. dhermes commented on Jan 28, 2017

    @dhermes
    dhermes
    on Jan 28, 2017
    Contributor
    More actions

    @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.

  2. junghoahnsc commented on Jan 28, 2017

    @junghoahnsc
    junghoahnsc
    on Jan 28, 2017
    Author
    More actions

    Yes, actually I tried to upgrade to google-cloud 0.22.0, but it showed the same issue.

  3. tseaver commented on Jan 29, 2017

    @tseaver
    tseaver
    on Jan 29, 2017
    Contributor
    More actions

    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?

  4. dhermes commented on Jan 30, 2017

    @dhermes
    dhermes
    on Jan 30, 2017
    Contributor
    More actions

    @tseaver The error is actually in protobuf itself.

  5. junghoahnsc commented on Jan 30, 2017

    @junghoahnsc
    junghoahnsc
    on Jan 30, 2017
    Author
    More actions

    Should I file this issue to https://github.com/google/protobuf?

  6. dhermes commented on Jan 30, 2017

    @dhermes
    dhermes
    on Jan 30, 2017
    Contributor
    More actions

    @junghoahnsc Maybe? I'm interested if @bjwatson or @geigerj (or @lukesneeringer) have any insights.

  7. dhermes
    added
    api: bigtableIssues related to the Bigtable API.
    packaging
    on Jan 30, 2017
  8. lukesneeringer commented on Jan 31, 2017

    @lukesneeringer
    lukesneeringer
    on Jan 31, 2017
    Contributor
    More actions

    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. :-(

  9. dhermes
    closed this as completedon Feb 2, 2017
  10. dhermes
    removed
    api: bigtableIssues related to the Bigtable API.
    on Feb 2, 2017
  11. dhermes commented on Feb 2, 2017

    @dhermes
    dhermes
    on Feb 2, 2017
    Contributor
    More actions

    @junghoahnsc Closing out since we can't really offer help. Please post back here if you aren't able to resolve?

  12. dhermes
    changed the title [-][Bigtable] Incompatible with CPP protobuf implementation for Python[/-] [+]Incompatible with CPP protobuf implementation for Python[/+] on Feb 2, 2017
  13. lukesneeringer commented on Feb 28, 2017

    @lukesneeringer
    lukesneeringer
    on Feb 28, 2017
    Contributor
    More actions

    This ended up being solved by this pull request in googleapis-common-protos.

  14. JustinBeckwith
    assigned
    dhermes
    on Feb 1, 2021
  15. parthea
    added a commit that references this issue on Oct 21, 2023

    move monitoring samples from python-docs-samples (#51)

    This issue will close once commit d95f563 is merged into the 'main' branch.
    d95f563
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dhermes
    dhermes

Labels

packaging

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.