Skip to content

Importing aiplatform fails after protobuf 4.21 #1257

@dragos-cojocari

Description

@dragos-cojocari

This started occurring today, May 26th after protobuf 4.21 has been launched. Trying to explicitly set protobuf version to 3.21.0 in the requirements file of the project importing aiplatform does not help either. The other Google Python APIs ( storage etc) do not seem affected by this.

Environment details

  • OS type and version: Pyton3.9.13-slim-bullseye
  • Python version: 3.9.,13
  • pip version: 22.04
  • google-cloud-aiplatform version: 1.13.0

Steps to reproduce

Build any Python code that imports google.aiplatform

Code example

from google.cloud import aiplatform

Stack trace

/tmp/.tox/py39/lib/python3.9/site-packages/google/cloud/aiplatform/__init__.py:41: in <module>
unit_1      |     from google.cloud.aiplatform.matching_engine import (
unit_1      | /tmp/.tox/py39/lib/python3.9/site-packages/google/cloud/aiplatform/matching_engine/__init__.py:26: in <module>
unit_1      |     from google.cloud.aiplatform.matching_engine.matching_engine_index_endpoint import (
unit_1      | /tmp/.tox/py39/lib/python3.9/site-packages/google/cloud/aiplatform/matching_engine/matching_engine_index_endpoint.py:30: in <module>
unit_1      |     from google.cloud.aiplatform.matching_engine._protos import match_service_pb2
unit_1      | /tmp/.tox/py39/lib/python3.9/site-packages/google/cloud/aiplatform/matching_engine/_protos/match_service_pb2.py:54: in <module>
unit_1      |     _descriptor.FieldDescriptor(
unit_1      | /tmp/.tox/py39/lib/python3.9/site-packages/google/protobuf/descriptor.py:560: in __new__
unit_1      |     _message.Message._CheckCalledFromGeneratedFile()
unit_1      | E   TypeError: Descriptors cannot not be created directly.
unit_1      | E   If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
unit_1      | E   If you cannot immediately regenerate your protos, some other possible workarounds are:
unit_1      | E    1. Downgrade the protobuf package to 3.20.x or lower.
unit_1      | E    2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).```

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: vertex-aiIssues related to the googleapis/python-aiplatform API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions