Protobuf: ImportError: cannot import name '_message'

Created on 25 Dec 2017  路  7Comments  路  Source: protocolbuffers/protobuf

I have installed the latest protobuf==3.5.1, on macOS High Sierra

Then I set all necessary environment variables:

PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp

And when I run the script, I get the following error:

File "/***/.env3/lib/python3.5/site-packages/google/protobuf/descriptor.py", line 46, in <module>
    from google.protobuf.pyext import _message
ImportError: cannot import name '_message'

And when I go to this file in Finder, I don't see the _message file.

Although, when I download the protobuf from google/tensorflow page, it is there.

Could you please resolve it?

python question

All 7 comments

PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp only works if you actually installed the version with C extension support and it's likely not the case here.

Hi, I just hit this error. Was there a resolution for this?

I'm stuck in this problem for a whole day. Is there anyone can help me? please.

I'm stuck in this problem for a whole day. Is there anyone can help me? please.

Oh, I solved it by downgrading tensorboard to 1.11.0.

i am also see the problem but i can not solve it ,i hope who can share the way

I have the same problem and I can't solve it too. Hope for quick help.

pypi install should give you the c++ implementation by default.
For other ways to install protobuf, please figure out how to install c++ implementation for that specific way.

Was this page helpful?
0 / 5 - 0 ratings