astrandb / miele

A modern integration for Miele devices in Home Assistant
MIT License
202 stars 30 forks source link

Setup failed for custom integration 'miele': Unable to import component: No module named 'flatdict' #570

Open WyriHaximus opened 3 hours ago

WyriHaximus commented 3 hours ago

The problem

Integration doesn't start

Version of miele integration having the issue?

v2024.8.1

Version of Home Assistant Core having the issue?

2024.10.3

Anything in the logs that might be useful for us?

Logger: homeassistant.setup
Source: setup.py:334
First occurred: 19:34:07 (1 occurrences)
Last logged: 19:34:07

Setup failed for custom integration 'miele': Unable to import component: No module named 'flatdict'
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 1027, in async_get_component
    self._component_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1007, 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 "/usr/src/homeassistant/homeassistant/loader.py", line 1067, 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.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 "/config/custom_components/miele/__init__.py", line 13, in <module>
    import flatdict
ModuleNotFoundError: No module named 'flatdict'

Additional information

Restarting HA doesn't fix this - refs #279

astrandb commented 3 hours ago

Same problem has been reported recently, though it works for many thousands of users. Is this a new install of the integration? How are you running HA? HAOS, docker, core venv?

WyriHaximus commented 3 hours ago

Same problem has been reported recently, though it works for many thousands of users.

Whoops did I miss an existing issue?

Is this a new install of the integration?

Existing install but upgraded HA

How are you running HA? HAOS, docker, core venv?

Kubernetes so Docker

astrandb commented 3 hours ago

Please see #568 It seems to be a problem with loading flatdict module in certain docker environments. Are there any errors or logs regarding flatdict when setting up the container? It is sometimes done in the container before you start HA.

WyriHaximus commented 2 hours ago

It seems to be a problem with loading flatdict module in certain docker environments. Are there any errors or logs regarding flatdict when setting up the container? It is sometimes done in the container before you start HA.

Haven't found anything yet in the logs besides what I shared. Did find flatdict in the deps directory so it is there. Will dig deeper into the logs

astrandb commented 1 hour ago

You can add these lines to your config/configuration.yaml, restart HA and see if anything more is revealed.

logger:
    default: info
    logs:
        custom_components.miele: debug
        pymiele: debug
WyriHaximus commented 59 minutes ago

Just rolled that out, the only things now I can find now are:

2024-10-23 22:12:00.250 INFO (SyncWorker_6) [homeassistant.util.package] Attempting install of flatdict==4.0.1
2024-10-23 22:12:08.819 INFO (SyncWorker_6) [homeassistant.util.package] Attempting install of pymiele==0.1.7
astrandb commented 54 minutes ago

Do you still get the stack trace as above?

WyriHaximus commented 37 minutes ago

Yes that is still there