Skip to content

Something seems broken with the protobuf definitions (or more likely the pip requirements) #1218

Closed
@Rudd-O

Description

@Rudd-O

says aioesphomeapi requires protobuf 4>, but this is not correct based on the actual observed results with protobuf 64 installed in the venv:

Jun 14 23:06:17 assistant hass[6700]: 2025-06-14 23:06:17.298 ERROR (ImportExecutor_0) [homeassistant.loader] Unexpected exception importing component homeassistant.components.esphome
Jun 14 23:06:17 assistant hass[6700]: Traceback (most recent call last):
Jun 14 23:06:17 assistant hass[6700]:   File "/opt/assistant/lib64/python3.13/site-packages/homeassistant/loader.py", line 1053, in _get_component
Jun 14 23:06:17 assistant hass[6700]:     ComponentProtocol, importlib.import_module(self.pkg_path)
Jun 14 23:06:17 assistant hass[6700]:                        ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
Jun 14 23:06:17 assistant hass[6700]:   File "/opt/assistant/lib64/python3.13/site-packages/homeassistant/util/loop.py", line 201, in protected_loop_func
Jun 14 23:06:17 assistant hass[6700]:     return func(*args, **kwargs)
Jun 14 23:06:17 assistant hass[6700]:   File "/usr/lib64/python3.13/importlib/__init__.py", line 88, in import_module
Jun 14 23:06:17 assistant hass[6700]:     return _bootstrap._gcd_import(name[level:], package, level)
Jun 14 23:06:17 assistant hass[6700]:            ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 14 23:06:17 assistant hass[6700]:   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
Jun 14 23:06:17 assistant hass[6700]:   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
Jun 14 23:06:17 assistant hass[6700]:   File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
Jun 14 23:06:17 assistant hass[6700]:   File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
Jun 14 23:06:17 assistant hass[6700]:   File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
Jun 14 23:06:17 assistant hass[6700]:   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
Jun 14 23:06:17 assistant hass[6700]:   File "/opt/assistant/lib64/python3.13/site-packages/homeassistant/components/esphome/__init__.py", line 5, in <module>
Jun 14 23:06:17 assistant hass[6700]:     from aioesphomeapi import APIClient
Jun 14 23:06:17 assistant hass[6700]:   File "/opt/assistant/lib64/python3.13/site-packages/aioesphomeapi/__init__.py", line 2, in <module>
Jun 14 23:06:17 assistant hass[6700]:     from .api_pb2 import (  # type: ignore[attr-defined] # noqa: F401
Jun 14 23:06:17 assistant hass[6700]:     ...<2 lines>...
Jun 14 23:06:17 assistant hass[6700]:     )
Jun 14 23:06:17 assistant hass[6700]:   File "/opt/assistant/lib64/python3.13/site-packages/aioesphomeapi/api_pb2.py", line 16, in <module>
Jun 14 23:06:17 assistant hass[6700]:     from . import api_options_pb2 as api__options__pb2
Jun 14 23:06:17 assistant hass[6700]:   File "/opt/assistant/lib64/python3.13/site-packages/aioesphomeapi/api_options_pb2.py", line 16, in <module>
Jun 14 23:06:17 assistant hass[6700]:     from google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2
Jun 14 23:06:17 assistant hass[6700]:   File "/opt/assistant/lib64/python3.13/site-packages/google/protobuf/descriptor_pb2.py", line 12, in <module>
Jun 14 23:06:17 assistant hass[6700]:     _runtime_version.ValidateProtobufRuntimeVersion(
Jun 14 23:06:17 assistant hass[6700]:     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Jun 14 23:06:17 assistant hass[6700]:         _runtime_version.Domain.PUBLIC,
Jun 14 23:06:17 assistant hass[6700]:         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 14 23:06:17 assistant hass[6700]:     ...<4 lines>...
Jun 14 23:06:17 assistant hass[6700]:         'google/protobuf/descriptor.proto'
Jun 14 23:06:17 assistant hass[6700]:         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 14 23:06:17 assistant hass[6700]:     )
Jun 14 23:06:17 assistant hass[6700]:     ^
Jun 14 23:06:17 assistant hass[6700]:   File "/opt/assistant/lib64/python3.13/site-packages/google/protobuf/runtime_version.py", line 106, in ValidateProtobufRuntimeVersion
Jun 14 23:06:17 assistant hass[6700]:     _ReportVersionError(
Jun 14 23:06:17 assistant hass[6700]:     ~~~~~~~~~~~~~~~~~~~^
Jun 14 23:06:17 assistant hass[6700]:         'Detected mismatched Protobuf Gencode/Runtime major versions when'
Jun 14 23:06:17 assistant hass[6700]:         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 14 23:06:17 assistant hass[6700]:         f' loading {location}: gencode {gen_version} runtime {version}.'
Jun 14 23:06:17 assistant hass[6700]:         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 14 23:06:17 assistant hass[6700]:         f' Same major version is required. {error_prompt}'
Jun 14 23:06:17 assistant hass[6700]:         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 14 23:06:17 assistant hass[6700]:     )
Jun 14 23:06:17 assistant hass[6700]:     ^
Jun 14 23:06:17 assistant hass[6700]:   File "/opt/assistant/lib64/python3.13/site-packages/google/protobuf/runtime_version.py", line 50, in _ReportVersionError
Jun 14 23:06:17 assistant hass[6700]:     raise VersionError(msg)
Jun 14 23:06:17 assistant hass[6700]: google.protobuf.runtime_version.VersionError: Detected mismatched Protobuf Gencode/Runtime major versions when loading google/protobuf/descriptor.proto: gencode 6.31.1 runtime 5.29.2. Same major version is required. See Protobuf version guarantees at https://protobuf.dev/support/cross-version-runtime-guarantee.

https://protobuf.dev/support/cross-version-runtime-guarantee/ says generated code and runtime must be same major version.

Yes, I should clarify: I manually installed protobuf 4 because some other project requires it — but, still, if your code has been generating the definitions using protogen version 6, your dependency is incorrectly specified and you must require protobuf version 6.

Metadata

Metadata

Assignees

No one assigned

    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