Hyundai-Kia-Connect / kia_uvo

A Home Assistant HACS integration that supports Kia Connect(Uvo) and Hyundai Bluelink. The integration supports the EU, Canada and the USA.
MIT License
413 stars 85 forks source link

Python dependencies are incompatible with the new HA version #699

Closed dimitrystd closed 1 year ago

dimitrystd commented 1 year ago

Region and Brand of car US, Hyundai

Version of the integration 2.11.0

Describe the bug I updated HA from 2023.3.1 -> 2023.7.3 and the component stopped working. See the same error on each HA restart.

Debug logs if an error occurred

2023-08-06 19:24:04.720 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing component custom_components.kia_uvo
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 813, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/kia_uvo/__init__.py", line 25, in <module>
    from .utils import DEFAULT_DISTANCE_UNIT_ARRAY, get_default_distance_unit
  File "/config/custom_components/kia_uvo/utils.py", line 13, in <module>
    from .KiaUvoApiEU import KiaUvoApiEU
  File "/config/custom_components/kia_uvo/KiaUvoApiEU.py", line 11, in <module>
    import push_receiver
  File "/usr/local/lib/python3.11/site-packages/push_receiver/__init__.py", line 1, in <module>
    from .push_receiver import *
  File "/usr/local/lib/python3.11/site-packages/push_receiver/push_receiver.py", line 11, in <module>
    from .mcs_pb2 import *
  File "/usr/local/lib/python3.11/site-packages/push_receiver/mcs_pb2.py", line 33, in <module>
    _descriptor.EnumValueDescriptor(
  File "/usr/local/lib/python3.11/site-packages/google/protobuf/descriptor.py", line 796, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
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.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
2023-08-06 19:24:04.732 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration kia_uvo: Unable to import component: Exception importing custom_components.kia_uvo
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 813, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/kia_uvo/__init__.py", line 25, in <module>
    from .utils import DEFAULT_DISTANCE_UNIT_ARRAY, get_default_distance_unit
  File "/config/custom_components/kia_uvo/utils.py", line 13, in <module>
    from .KiaUvoApiEU import KiaUvoApiEU
  File "/config/custom_components/kia_uvo/KiaUvoApiEU.py", line 11, in <module>
    import push_receiver
  File "/usr/local/lib/python3.11/site-packages/push_receiver/__init__.py", line 1, in <module>
    from .push_receiver import *
  File "/usr/local/lib/python3.11/site-packages/push_receiver/push_receiver.py", line 11, in <module>
    from .mcs_pb2 import *
  File "/usr/local/lib/python3.11/site-packages/push_receiver/mcs_pb2.py", line 33, in <module>
    _descriptor.EnumValueDescriptor(
  File "/usr/local/lib/python3.11/site-packages/google/protobuf/descriptor.py", line 796, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
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.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 215, in _async_setup_component
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 821, in get_component
    raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing custom_components.kia_uvo

Additional context I run HA as a container.

cdnninja commented 1 year ago

Push receiver was removed from our code some time ago. Line 11 of the eu library doesn't contain this.

Something seems wrong with your system updating libraries. Maybe try a remove and install.

dimitrystd commented 1 year ago

Reinstall helped me. Thank you.