home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.32k stars 30.63k forks source link

Setup failed for 'evohome': Unable to import component: No module named 'evohomeasync' #123955

Closed mattjam closed 2 months ago

mattjam commented 2 months ago

The problem

In versions 2024.7.0 to the latest (2024.8.1), the evohome integration fails to load

What version of Home Assistant Core has the issue?

core-2024.7.0

What was the last working version of Home Assistant Core?

core-2024.6.4

What type of installation are you running?

Home Assistant Core

Integration causing the issue

evohome

Link to integration documentation on our website

https://www.home-assistant.io/integrations/evohome

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.setup
Source: setup.py:322
First occurred: 21:42:39 (1 occurrences)
Last logged: 21:42:39

Setup failed for 'evohome': Unable to import component: No module named 'evohomeasync'
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/setup.py", line 322, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/loader.py", line 1010, in async_get_component
    self._component_future.result()
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/loader.py", line 990, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/loader.py", line 1050, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/evohome/__init__.py", line 13, in <module>
    import evohomeasync as ev1
ModuleNotFoundError: No module named 'evohomeasync'

Additional information

I have these installed in my python venv:

$ pip list | grep evohome evohome-async 0.4.20 evohomeclient 0.3.7

home-assistant[bot] commented 2 months ago

Hey there @zxdavb, mind taking a look at this issue as it has been labeled with an integration (evohome) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `evohome` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign evohome` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


evohome documentation evohome source (message by IssueLinks)

zxdavb commented 2 months ago

Thanks for you submission of this issue.

I must admit, this really smells like an issue restricted to your system (rather than a problem with HA's source code).

I note you can do this:

$ pip list | grep evohome
evohome-async 0.4.20
evohomeclient 0.3.7

... so, I suggest you go to the CLI and issue this command:

pip uninstall -y evohome-async evohomeclient

... and restart HA.

My expectation is that this should resolve the issue for you.

For now, I am closing this issue, but do add a comment if that doesn't sort things out for you.

mattjam commented 2 months ago

Thanks, I tried that but it's still not working.

My steps were: (already running 2024.6.4)

zxdavb commented 2 months ago

Your running core (why?) - Did you run setup/script?

I would just delete the venv & start again with that.

mattjam commented 2 months ago

I've run core since the beginning, it's still meant to be supported and it's not caused any issues.

I tried a brand new venv on python 3.12 and 2024.8.1, but still no luck :( What/where is setup/script?

There were a bunch of evohome changes in 2024.7 (https://www.home-assistant.io/changelogs/core-2024.7) and that's the version that started having issues

zxdavb commented 2 months ago

I've run core since the beginning

I run core for dev - it is not really suitable for end-users. Please consider migrating to Hass OS.

What/where is setup/script?

Sorry, I miss-typed - it's script/setup.

There were a bunch of evohome changes in 2024.7 (https://www.home-assistant.io/changelogs/core-2024.7) and that's the version that started having issues

But the problem is: it appears only to cause issues for you?

If a new venv with script/setup doesn't do the trick...

Are you still seeing this:

$ pip list | grep evohome
evohome-async 0.4.20
evohomeclient 0.3.7

Do you have a custom component somewhere (with an older copy of evohome)? Is your core folder corrupt?

I am sorry I cannot help more.

mattjam commented 2 months ago

Thanks zxdavb, I have some custom components, none mentioning evohome, but I tried a fresh install without them and still the same.

I tracked it down to evohomeasync/ and evohomeasync2/ not being present in /srv/homeassistant/'s lib/python3.12/site-packages/. I don't know how to install them manually so I copied them over from a 2024.6.4 backup and things now work. I don't know enough about how the site-packages work, but maybe it's not an issue with the evohome integration, but instead whatever manifest is used to download/populate that directory.

Shame that it's just me having this problem, but maybe these breadcrumbs might help if someone else runs in to this

zxdavb commented 2 months ago

I don't know how to install them manually so I copied them over from a 2024.6.4 backup and things now work. I don't know enough about how the site-packages work, but maybe it's not an issue with the evohome integration, but instead whatever manifest is used to download/populate that directory.

HA should copy these for you, using evohome's manifest. I do not know why it has not, but I suspect your system is corrupt.

The fact is: Your work-around is a recipe for disaster.

I most strongly advise you to switch to using a consumer-level version of HA such as HA OS.