Skip to content

Python: protobuf==4.21.0rc1 adds dependency on grpcio-tools #9954

@parthea

Description

@parthea

What version of protobuf and what language are you using?
Version: 4.21.0rc1
Language: Python

What operating system (Linux, Windows, ...) and version?
Ubuntu 20.04.4 LTS

What runtime / compiler are you using (e.g., python version or gcc version)
Python 3.9.12

python -m grpc_tools.protoc --version
libprotoc 3.19.4

What did you do?
Steps to reproduce the behavior:

  1. Run pip install googleapis-common-protos
  2. In python shell, run >>> from google.rpc import error_details_pb2
  3. Observe that no error occurs
  4. Run pip install protobuf==4.21.0rc1 to install the pre-release version of protobuf
  5. In python shell, run >>> from google.rpc import error_details_pb2
  6. Observe the following error
>>> from google.rpc import error_details_pb2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/google/rpc/error_details_pb2.py", line 52, in <module>
    _descriptor.FieldDescriptor(
  File "/usr/local/lib/python3.9/site-packages/google/protobuf/descriptor.py", line 560, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
AttributeError: module 'google._upb._message' has no attribute 'Message'. Did you mean: 'CMessage'?
  1. Install grpcio-tools==1.44.0 or newer
  2. In python shell, run >>> from google.rpc import error_details_pb2
  3. Observe that no error occurs
  4. Uninstall grpcio-tools
  5. In python shell, run >>> from google.rpc import error_details_pb2
  6. Observe that no error occurs

What did you expect to see
I expected to run from google.rpc import error_details_pb2 in a python shell successfully after installing both googleapis-common-protos and protobuf==4.21.0rc1

What did you see instead?
I saw this error

>>> from google.rpc import error_details_pb2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/google/rpc/error_details_pb2.py", line 52, in <module>
    _descriptor.FieldDescriptor(
  File "/usr/local/lib/python3.9/site-packages/google/protobuf/descriptor.py", line 560, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
AttributeError: module 'google._upb._message' has no attribute 'Message'. Did you mean: 'CMessage'?

The strange thing is that installing grpcio-tools solved the issue, however removing grpcio-tools did not bring the issue back.

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment
I used a clean environment for testing, only installing googleapis-common-protos and protobuf==4.21.0rc1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions