Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with HA 2024.12.0 - Unable to import component: No module named 'msmart' #274

Open
Hubert2208 opened this issue Dec 6, 2024 · 6 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@Hubert2208
Copy link

Hubert2208 commented Dec 6, 2024

With HomeAssistant 2024.12.0 i got an Error-Message:

Logger: homeassistant.setup
Quelle: setup.py:334
Erstmals aufgetreten: 5. Dezember 2024 um 19:17:42 (1 Vorkommnisse)
Zuletzt protokolliert: 5. Dezember 2024 um 19:17:42

Setup failed for custom integration 'midea_ac': Unable to import component: No module named 'msmart'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1034, in async_get_component
    self._component_future.result()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1014, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        self._get_component, True
        ^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1074, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, 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 1022, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/midea_ac/__init__.py", line 11, in <module>
    from msmart import __version__ as MSMART_VERISON
ModuleNotFoundError: No module named 'msmart'
@mill1000 mill1000 added the bug Something isn't working label Dec 6, 2024
@mill1000
Copy link
Owner

mill1000 commented Dec 6, 2024

We've seen something like this a few times (#223, #255). It seems that certain environment's don't properly install dependencies: home-assistant/core#127966

You can try clearing your /config/deps, or you can try a number of the workarounds presented in home-assistant/core#127966.

This was resolved in the above community thread.

In summary, both users had older versions of msmart-ng in their /config/deps directory, The recommended resolution was to remove all the contents of /config/deps as it is generally deprecated.

@dj21d Left specific instructions on removing the directory via the SSH Add-on here:

https://community.home-assistant.io/t/custom-integration-requirements-failing-to-update/772204/23?u=mill1000

I wasn't able to replicate this issue with a fresh Docker container "install".

@mill1000 mill1000 added the duplicate This issue or pull request already exists label Dec 6, 2024
@mill1000 mill1000 changed the title Compatibility with HA 2024.12.0 Compatibility with HA 2024.12.0 - Unable to import component: No module named 'msmart' Dec 6, 2024
@Hubert2208
Copy link
Author

seems to be a problem with HA running in a container

@mill1000
Copy link
Owner

mill1000 commented Dec 7, 2024

Like I said I wasn't able to reproduce with a fresh container and config directory, so perhaps it's caused by something when upgrading.

Did you try clearing /config/deps?

@Hubert2208
Copy link
Author

yep, i tried to delete /config/deps.
HA recreates the folder on Restart with same files inside, like before

@Hubert2208
Copy link
Author

I found now a solution for the problem.
The Folder /config/deps/lib/python3.12/ have to be moved to /config/deps/lib/python3.13/
The new Version auf HA has bumped Python to Version 3.13
I also had an old folder /config/deps/lib/python3.11/. This one i deleted.

@mill1000
Copy link
Owner

mill1000 commented Dec 7, 2024

What's odd is I was under the impression /config/deps was deprecated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants