Closed Ulrar closed 2 weeks ago
Sorry per the docs
For clarity, to receive support from the MA team: - The docker install must be a simple standalone container (e.g. not using kubernetes)
I have the same error and I am running Home Assistant in a normal container and Music Assistant also in a normal container. Just updated the containers and I'm running Home Assistant 2024.11.1 and Music Assistant 2024.11.2. Things worked fine before 2024.11.
I'm having the same issue. Running in kubernetes:
Logger: homeassistant.setup
Source: setup.py:334
First occurred: 11:45:27 (1 occurrences)
Last logged: 11:45:27
Setup failed for custom integration 'mass': Unable to import component: No module named 'music_assistant_client'
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 1031, in async_get_component
self._component_future.result()
File "/usr/src/homeassistant/homeassistant/loader.py", line 1011, 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 1071, 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/mass/__init__.py", line 22, in <module>
from music_assistant_client import MusicAssistantClient
ModuleNotFoundError: No module named 'music_assistant_client'
This worked fine before 2024.11. Why woulld this not work on kubernetes?
I don't think it has anything to do with k8s, that's just a coincidence. Are you using linuxserver/homeassistant as well to be rootless?
That's much more likely to be the issue, as the official container runs as root and you usually don't want that. Not that it should prevent a module from being installed, as it works fine with every other integrations
I don't think it has anything to do with k8s, that's just a coincidence. Are you using linuxserver/homeassistant as well to be rootless?
That's much more likely to be the issue, as the official container runs as root and you usually don't want that. Not that it should prevent a module from being installed, as it works fine with every other integrations
I'm running the official homeassistant container. It's all running on an openshift install. Both homeassistant and musicassistant containers are running as root.
I suppose @francais01 already said they're running a regular container anyway, so unrelated as well.
No idea !
If you may run into any issues when using a docker install vs the recommended/standard Home Assistant add-on, you may try to simply run Home Assistant OS on a VM on your computer or a spare RPi and see if you can reproduce the issue with that setup.
I've reverted to the 2024.10.1 version of the addon, which works just fine.
The following fix from an older issue worked for me. I deleted everything in /config/deps/lib/python3.12
and in that directory did ln -s ../.. site-packages
.
https://github.com/music-assistant/hass-music-assistant/issues/3031#issuecomment-2416314915
So, it is strange that other components can find their dependencies in /config/deps
but not Music Assistant. 🤔
This is a HA issue and is essentially the same as the issue @francais01 linked to. As mentioned in there you should raise an issue with them. This will improve or be solved when the integration goes into core next month.
After following the trail from other issues, I found a workaround mentioned here: https://github.com/home-assistant/core/issues/127966#issuecomment-2468391662 ... In short, for other k8s users, add this to your deployment YAML:
spec:
containers:
- name: hass
image: docker.io/homeassistant/home-assistant:stable
env:
- name: "PYTHONPATH"
value: "/config/deps"
Below there someone added a similar solution if you're using Helm.
Still a little fuzzy on the root cause, and whether you get bit seems to depend on the sequence of installs/upgrades of HA 2024.10 and 2024.11 and various HACS modules, but in any case the problem is that music_assistant_client
gets installed in /config/deps
and not loaded from there... adding the PYTHONPATH
environment variable adds /config/deps
to the loaded paths, so music_assistant_client
gets loaded.
That env var does indeed do the trick. One note for anyone having issues with HA crashing after adding it, I had to delete my/config/deps folder entirely and restart to get a clean one.
What version of Music Assistant has the issue?
N/A
What version of the Home Assistant Integration have you got installed?
2024.11.x
Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?
The problem
Since 2024.11 the integration fails to load
How to reproduce
Try to load the integration on any 2024.11 version
Music Providers
N/A
Player Providers
N/A
Full log output
Additional information
I'm using linuxserver/homeassistant on kubernetes, which presumably is relevant although I don't have issues with any other integrations, and I do have a lot of them installed from hacs.
Some other custom integration do depend on uv installing external libraries and work, so uv is working.
Downgrading the integration from hacs to 2024.10 and it loads fine again
What version of Home Assistant Core are your running
2024.11.1
What type of installation are you running?
Home Assistant Container
On what type of hardware are you running?
Alternative