2

I get the following error when trying to import simpletransformers:

Traceback (most recent call last):

  File "...py", line 106, in <module>

    from simpletransformers.classification import ClassificationModel, ClassificationArgs

  File "/home/work/anaconda/lib/python3.6/site-packages/simpletransformers/classification/__init__.py", line 1, in <module>

    from simpletransformers.classification.classification_model import ClassificationModel

  File "/home/work/anaconda/lib/python3.6/site-packages/simpletransformers/classification/classification_model.py", line 32, in <module>

    from tensorboardX import SummaryWriter

  File "/home/work/anaconda/lib/python3.6/site-packages/tensorboardX/__init__.py", line 4, in <module>

    from .record_writer import RecordWriter

  File "/home/work/anaconda/lib/python3.6/site-packages/tensorboardX/record_writer.py", line 18, in <module>

    from google.cloud import storage

  File "/home/work/anaconda/lib/python3.6/site-packages/google/cloud/storage/__init__.py", line 38, in <module>

    from google.cloud.storage.batch import Batch

  File "/home/work/anaconda/lib/python3.6/site-packages/google/cloud/storage/batch.py", line 29, in <module>

    from google.cloud import _helpers

  File "/home/work/anaconda/lib/python3.6/site-packages/google/cloud/_helpers.py", line 33, in <module>

    from google.protobuf import duration_pb2

  File "/home/work/anaconda/lib/python3.6/site-packages/google/protobuf/duration_pb2.py", line 21, in <module>

    create_key=_descriptor._internal_create_key,

AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'

I already tried upgrading protobuf and have same protoc version like in this question: How to solve "AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key"?

I also tried upgrading other packages. What else could be the problem?

I am having the issue on cloud linux machine. On my local windows machine, there is no problem.

Mutlu Simsek
  • 1,088
  • 14
  • 22

2 Answers2

3

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.

If python3, use pip3 install --upgrade protobuf

Ali Gökkaya
  • 408
  • 6
  • 20
0

I encountered the same issue of protobuf version is equal to protoc and error still exist. But after rebooting my computer, It's work.

chilin
  • 420
  • 7
  • 9