hacs / integration

HACS gives you a powerful UI to handle downloads of all your custom needs.
https://hacs.xyz
MIT License
4.87k stars 1.22k forks source link

TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard' #3768

Closed ClusterM closed 3 weeks ago

ClusterM commented 3 weeks ago

System Health details

System Information

version core-2024.6.0
installation_type Home Assistant Core
dev false
hassio false
docker false
user cluster
virtualenv true
python_version 3.12.4
os_name Linux
os_version 5.10.160-legacy-rk35xx
arch aarch64
timezone Asia/Yerevan
config_dir /home/cluster/.homeassistant
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Dashboards dashboards | 2 -- | -- resources | 1 views | 9 mode | storage
Recorder oldest_recorder_run | April 24, 2024 at 18:53 -- | -- current_recorder_run | June 7, 2024 at 17:56 estimated_db_size | 4169.91 MiB database_engine | mysql database_version | 10.11.6

Checklist

Describe the issue

Hi. I just upgraded to Python 3.12.4 and Home Assistant 2024.6.0. Installed the latest (1.34.0) HACS using wget -O - https://get.hacs.xyz | bash -. Restarted Home Assistant, then tried to add an integration, but I bumped into an error: Config flow could not be loaded: {"message":"Invalid handler specified"}

image

Log attached below.

Also tried commit 92c0e05acc4267f602628ba84ae889809a503b88 with the same result.

Reproduction steps

  1. Build Python 3.12.4 (i used ./configure --enable-optimizations --with-ensurepip=install --enable-loadable-sqlite-extensions --with-lto --prefix=/usr)
  2. Create venv: python3 -m venv hass
  3. Activate it: . hass/bin/activate
  4. Install HomeAssistant: pip install homeassistant
  5. Install HACS: wget -O - https://get.hacs.xyz | bash -
  6. Start Home Assistant: hass
  7. Open Home Assistant frontend in the browser -> settings -> devices & services -> add integration -> HACS

Result: Config flow could not be loaded: {"message":"Invalid handler specified"}

Debug logs

Traceback (most recent call last):
  File "/home/cluster/hass/lib/python3.12/site-packages/homeassistant/loader.py", line 1052, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cluster/hass/lib/python3.12/site-packages/homeassistant/util/loop.py", line 131, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/cluster/.homeassistant/custom_components/hacs/__init__.py", line 12, in <module>
    from aiogithubapi import AIOGitHubAPIException, GitHub, GitHubAPI
  File "/home/cluster/hass/lib/python3.12/site-packages/aiogithubapi/__init__.py", line 20, in <module>
    from .device import GitHubDeviceAPI
  File "/home/cluster/hass/lib/python3.12/site-packages/aiogithubapi/device.py", line 14, in <module>
    from .client import GitHubClient
  File "/home/cluster/hass/lib/python3.12/site-packages/aiogithubapi/client.py", line 27, in <module>
    from .legacy.client import AIOGitHubAPIClient as LegacyAIOGitHubAPIClient
  File "/home/cluster/hass/lib/python3.12/site-packages/aiogithubapi/legacy/client.py", line 15, in <module>
    from ..helpers import async_call_api
  File "/home/cluster/hass/lib/python3.12/site-packages/aiogithubapi/helpers.py", line 8, in <module>
    from sigstore.verify import (
  File "/home/cluster/hass/lib/python3.12/site-packages/sigstore/verify/__init__.py", line 54, in <module>
    from sigstore.verify.models import (
  File "/home/cluster/hass/lib/python3.12/site-packages/sigstore/verify/models.py", line 30, in <module>
    from sigstore._internal.rekor import RekorClient
  File "/home/cluster/hass/lib/python3.12/site-packages/sigstore/_internal/rekor/__init__.py", line 19, in <module>
    from .client import RekorClient
  File "/home/cluster/hass/lib/python3.12/site-packages/sigstore/_internal/rekor/client.py", line 45, in <module>
    class RekorBundle(BaseModel):
  File "/home/cluster/hass/lib/python3.12/site-packages/pydantic/main.py", line 286, in __new__
    cls.__try_update_forward_refs__()
  File "/home/cluster/hass/lib/python3.12/site-packages/pydantic/main.py", line 807, in __try_update_forward_refs__
    update_model_forward_refs(cls, cls.__fields__.values(), cls.__config__.json_encoders, localns, (NameError,))
  File "/home/cluster/hass/lib/python3.12/site-packages/pydantic/typing.py", line 554, in update_model_forward_refs
    update_field_forward_refs(f, globalns=globalns, localns=localns)
  File "/home/cluster/hass/lib/python3.12/site-packages/pydantic/typing.py", line 520, in update_field_forward_refs
    field.type_ = evaluate_forwardref(field.type_, globalns, localns or None)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cluster/hass/lib/python3.12/site-packages/pydantic/typing.py", line 66, in evaluate_forwardref
    return cast(Any, type_)._evaluate(globalns, localns, set())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'

Diagnostics dump

No response

hacs-bot[bot] commented 3 weeks ago

Make sure you have read the issue guidelines and that you filled out the entire template.

If you have an issue identical to this, do not add comments like "same here", "i have this too", instead add a :+1: reaction to the issue description. Thanks! :+1:

ludeeus commented 3 weeks ago

Your packages is too new, install the require me Ts file from the home assistant repo, or use contianer/OS.

jretz commented 3 weeks ago

This is consistent with an issue that homeassistant's pinned version of pydantic (1.10.12) has with Python 3.12.4: https://github.com/pydantic/pydantic/issues/9607. Pydantic Version 1.10.16 was released a couple of hours ago addressing this. hacs may not work with Python 3.12.4 until homeassistant updates its version pin (this is also mentioned on the home-assistant/core Nest Integration issue referenced above, hopefully leading to a fix).

timber-schroeder commented 2 weeks ago

In line with what jretz mentioned I just upgraded pydantic in the home assistant venv to 1.10.16 and everything is working fine now. Not sure why the home assistant package has a patch version pinned instead of something like pydantic~=1.10.0, as that's kind of the whole point of semantic versioning.

pip install pydantic==1.10.16