How to solve "AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key"? How to solve "AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key"? python python

How to solve "AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key"?


The protoc version I got through pip show protobuf and protoc --version were different. The version in pip was a bit outdated.

After I upgraded the pip version with

pip install --upgrade protobuf

the problem was solved.


These three commands solved it for me:

pip uninstall protobuf python3-protobufpip install --upgrade pippip install --upgrade protobuf


After trying many different solutions (i'm working on a Mac) the one that worked for me is to reinstall protobuf using:

PROTOC_ZIP=protoc-3.7.1-osx-x86_64.zipcurl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/$PROTOC_ZIPsudo unzip -o $PROTOC_ZIP -d /usr/local bin/protocsudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'rm -f $PROTOC_ZIP

As is highlighted in this article