core: Integrations that require a Python module installation fail to add on 2024.10.1 when installed through HACS
The problem
Hey folks,
I’m in a bit of a pickle trying to add integrations from HACS.
I’ve recently started with a fresh install of 2024.10.1.
After successfully installing/downloading certain integrations through HACS, I am unable to add them to Home Assistant. When adding it, I get an error dialog with the message:
Config flow could not be loaded: {“message”:“Invalid handler specified”}
In the Home Assistant log, it seems to correlate with a message like the following:
2024-10-08 21:40:31.362 INFO (SyncWorker_9) [homeassistant.util.package] Attempting install of meross_iot==0.4.7.3 2024-10-08 21:40:31.362 DEBUG (SyncWorker_9) [homeassistant.util.package] Running uv pip command: args=[‘uv’, ‘pip’, ‘install’, ‘–quiet’, ‘meross_iot==0.4.7.3’, ‘–index-strategy’, ‘unsafe-first-match’, ‘–upgrade’, ‘–constraint’, ‘/usr/src/homeassistant/homeassistant/package_constraints.txt’, ‘–target’, ‘/config/deps’] 2024-10-08 21:40:40.992 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration meross_cloud: No module named ‘meross_iot’
That’s specifically when trying to add the “Meross Integration” integration.
It seems integrations that need to install a Python module fail. Integrations that don’t need to install any Python modules, succeed, like themes.
For example, besides the “Meross Integration”, the “Tapo Controller” integration also fails to get added, but the Python module in the ERROR log message is different.
Please let me know if you need any more information. As I can reproduce this in a container I can configure and retrieve whatever is needed.
Complete Logs:
Reproduction steps
- Set up a fresh 2024.10.1 container. For e.g.:
# Change to docker if needed...
podman run -d \
--name homeassistant \
--privileged \
--restart=unless-stopped \
-e TZ=Australia/Brisbane \
-v ./home-assistant:/config \
-v /run/dbus:/run/dbus:ro \
--network=host \
ghcr.io/home-assistant/home-assistant:2024.10.1
- Install HACS as per https://hacs.xyz/docs/use/download/download/#to-download-hacs
- Install one of the mentioned integrations through HACS, for example “Meross Integration” or “Tapo Controller”.
- Try to add said integration to Home Assistant.
Cheers!
What version of Home Assistant Core has the issue?
core-2024.10.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
No response
Link to integration documentation on our website
No response
Diagnostics information
Diagnostics dump
{
"home_assistant": {
"installation_type": "Unknown",
"version": "2024.10.1",
"dev": false,
"hassio": false,
"virtualenv": false,
"python_version": "3.12.4",
"docker": false,
"arch": "x86_64",
"timezone": "Australia/Brisbane",
"os_name": "Linux",
"os_version": "6.10.12-200.fc40.x86_64",
"run_as_root": false
},
"custom_components": {
"hacs": {
"documentation": "https://hacs.xyz/docs/configuration/start",
"version": "2.0.1",
"requirements": [
"aiogithubapi>=22.10.1"
]
},
"meross_cloud": {
"documentation": "https://www.home-assistant.io/components/meross_cloud",
"version": "1.3.3",
"requirements": [
"meross_iot==0.4.7.3"
]
},
"tapo": {
"documentation": "https://github.com/petretiandrea/home-assistant-tapo-p100",
"version": "3.1.2",
"requirements": [
"plugp100==5.1.3"
]
}
},
"integration_manifest": {
"domain": "hacs",
"name": "HACS",
"after_dependencies": [
"python_script"
],
"codeowners": [
"ludeeus"
],
"config_flow": true,
"dependencies": [
"http",
"websocket_api",
"frontend",
"persistent_notification",
"lovelace",
"repairs"
],
"documentation": "https://hacs.xyz/docs/configuration/start",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/hacs/integration/issues",
"requirements": [
"aiogithubapi>=22.10.1"
],
"version": "2.0.1",
"is_built_in": false
},
"setup_times": {
"null": {
"setup": 1.2402997526805848e-05
},
"01J9NYGMG1K33YZF6VXF512F8Z": {
"wait_import_platforms": -0.20091842800320592,
"wait_base_component": -0.0005247549997875467,
"config_entry_setup": 0.22828936600126326
}
},
"data": {
"entry": {
"created_at": "2024-10-08T11:34:00.449689+00:00",
"data": {
"token": "**REDACTED**"
},
"discovery_keys": {},
"disabled_by": null,
"domain": "hacs",
"entry_id": "01J9NYGMG1K33YZF6VXF512F8Z",
"minor_version": 1,
"modified_at": "2024-10-08T11:34:00.449691+00:00",
"options": {
"experimental": true
},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "user",
"title": "",
"unique_id": null,
"version": 1
},
"hacs": {
"stage": "running",
"version": "2.0.1",
"disabled_reason": null,
"new": false,
"startup": false,
"categories": [
"theme",
"integration",
"plugin",
"template"
],
"renamed_repositories": {},
"archived_repositories": [],
"ignored_repositories": [],
"lovelace_mode": "storage",
"configuration": {
"appdaemon": false,
"country": "ALL",
"debug": false,
"dev": false,
"python_script": false,
"release_limit": 5,
"theme": false
}
},
"custom_repositories": [],
"repositories": [
{
"data": {
"archived": false,
"authors": [
"@ludeeus"
],
"category": "integration",
"config_flow": false,
"default_branch": null,
"description": "HACS gives you a powerful UI to handle downloads of all your custom needs.",
"domain": "hacs",
"downloads": 313186,
"etag_repository": "W/\"305d721bfb9633898fa1781a301dff658c3d0ff2cf40d3e2d349f8932a5791f3\"",
"etag_releases": null,
"file_name": "",
"first_install": false,
"full_name": "hacs/integration",
"hide": false,
"has_issues": true,
"id": "172733314",
"installed_commit": null,
"installed_version": "2.0.1",
"installed": true,
"last_commit": null,
"last_updated": "2024-10-07T14:36:04Z",
"last_version": "2.0.1",
"manifest_name": "HACS",
"new": false,
"open_issues": 0,
"prerelease": null,
"published_tags": [],
"releases": true,
"selected_tag": null,
"show_beta": false,
"stargazers_count": 5282,
"topics": [
"community",
"package-manager"
]
},
"integration_manifest": {},
"repository_manifest": {
"content_in_root": false,
"country": [],
"filename": "hacs.zip",
"hacs": "0.19.0",
"hide_default_branch": true,
"homeassistant": "2024.4.1",
"manifest": {
"name": "HACS",
"zip_release": true,
"hide_default_branch": true,
"homeassistant": "2024.4.1",
"hacs": "0.19.0",
"filename": "hacs.zip"
},
"name": "HACS",
"persistent_directory": null,
"render_readme": false,
"zip_release": true
},
"ref": null,
"paths": {
"localpath": "/config/custom_components/hacs",
"local": "/config/custom_components/hacs",
"remote": "custom_components"
}
},
{
"data": {
"archived": false,
"authors": [
"@albertogeniola"
],
"category": "integration",
"config_flow": false,
"default_branch": null,
"description": "Custom component that leverages the Meross IoT library to integrate with Homeassistant",
"domain": "meross_cloud",
"downloads": 0,
"etag_repository": "W/\"4e4f614b8b989f05d0f32fed275db661e94c9335cd1bc99b164efcf0986bfcb0\"",
"etag_releases": null,
"file_name": "",
"first_install": false,
"full_name": "albertogeniola/meross-homeassistant",
"hide": false,
"has_issues": true,
"id": "191831638",
"installed_commit": "812f589",
"installed_version": "v1.3.3",
"installed": true,
"last_commit": "812f589",
"last_updated": "2024-09-03T12:09:10Z",
"last_version": "v1.3.3",
"manifest_name": "Meross Cloud IoT",
"new": false,
"open_issues": 0,
"prerelease": null,
"published_tags": [],
"releases": true,
"selected_tag": null,
"show_beta": false,
"stargazers_count": 721,
"topics": [
"meross",
"meross-homeassistant"
]
},
"integration_manifest": {},
"repository_manifest": {
"content_in_root": false,
"country": [],
"filename": null,
"hacs": "1.6.0",
"hide_default_branch": false,
"homeassistant": "2024.1",
"manifest": {
"name": "Meross Integration",
"hacs": "1.6.0",
"homeassistant": "2024.1"
},
"name": "Meross Integration",
"persistent_directory": null,
"render_readme": false,
"zip_release": false
},
"ref": null,
"paths": {
"localpath": "/config/custom_components/meross_cloud",
"local": "/config/custom_components/meross_cloud",
"remote": "custom_components"
}
},
{
"data": {
"archived": false,
"authors": [
"@petretiandrea"
],
"category": "integration",
"config_flow": false,
"default_branch": null,
"description": "A custom integration to control Tapo devices from home assistant.",
"domain": "tapo",
"downloads": 0,
"etag_repository": "W/\"9c39095aaf36143f5c05a3f85be1d7cf50f372010a4d8002f74b37d8b0e358d4\"",
"etag_releases": null,
"file_name": "",
"first_install": false,
"full_name": "petretiandrea/home-assistant-tapo-p100",
"hide": false,
"has_issues": true,
"id": "323923603",
"installed_commit": "c41351b",
"installed_version": "3.1.4",
"installed": true,
"last_commit": "c41351b",
"last_updated": "2024-10-07T19:02:00Z",
"last_version": "3.1.4",
"manifest_name": "TP-Link Tapo",
"new": false,
"open_issues": 0,
"prerelease": null,
"published_tags": [],
"releases": true,
"selected_tag": null,
"show_beta": false,
"stargazers_count": 813,
"topics": [
"energy",
"l510",
"l530",
"l900",
"monitoring",
"p100",
"p105",
"p110",
"smart-plug",
"tapo",
"tapo-device",
"tapo-light-bulb",
"tp-link",
"tplink"
]
},
"integration_manifest": {},
"repository_manifest": {
"content_in_root": false,
"country": [],
"filename": null,
"hacs": "1.6.0",
"hide_default_branch": false,
"homeassistant": "2024.0.0",
"manifest": {
"name": "Tapo Controller",
"hacs": "1.6.0",
"render_readme": true,
"homeassistant": "2024.0.0"
},
"name": "Tapo Controller",
"persistent_directory": null,
"render_readme": true,
"zip_release": false
},
"ref": null,
"paths": {
"localpath": "/config/custom_components/tapo",
"local": "/config/custom_components/tapo",
"remote": "custom_components"
}
}
],
"rate_limit": {
"resources": {
"core": {
"limit": 5000,
"used": 0,
"remaining": 5000,
"reset": 1728392370
},
"search": {
"limit": 30,
"used": 0,
"remaining": 30,
"reset": 1728388830
},
"graphql": {
"limit": 5000,
"used": 0,
"remaining": 5000,
"reset": 1728392370
},
"integration_manifest": {
"limit": 5000,
"used": 0,
"remaining": 5000,
"reset": 1728392370
},
"source_import": {
"limit": 100,
"used": 0,
"remaining": 100,
"reset": 1728388830
},
"code_scanning_upload": {
"limit": 1000,
"used": 0,
"remaining": 1000,
"reset": 1728392370
},
"actions_runner_registration": {
"limit": 10000,
"used": 0,
"remaining": 10000,
"reset": 1728392370
},
"scim": {
"limit": 15000,
"used": 0,
"remaining": 15000,
"reset": 1728392370
},
"dependency_snapshots": {
"limit": 100,
"used": 0,
"remaining": 100,
"reset": 1728388830
}
},
"rate": {
"limit": 5000,
"used": 0,
"remaining": 5000,
"reset": 1728392370
}
}
}
}
Example YAML snippet
No response
Anything in the logs that might be useful for us?
2024-10-08 21:44:19.016 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-10-08 21:44:19.017 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration meross_cloud which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-10-08 21:44:19.017 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration tapo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-10-08 21:44:19.186 INFO (MainThread) [homeassistant.setup] Setting up system_log
2024-10-08 21:44:19.216 INFO (MainThread) [homeassistant.setup] Setup of domain logger took 0.03 seconds
2024-10-08 21:44:19.216 INFO (MainThread) [homeassistant.setup] Setup of domain system_log took 0.03 seconds
2024-10-08 21:44:19.216 INFO (MainThread) [homeassistant.bootstrap] Setting up frontend: {'frontend'}
2024-10-08 21:44:19.216 INFO (MainThread) [homeassistant.setup] Setting up http
2024-10-08 21:44:19.216 INFO (MainThread) [homeassistant.setup] Setting up device_automation
2024-10-08 21:44:19.216 INFO (MainThread) [homeassistant.setup] Setup of domain device_automation took 0.00 seconds
2024-10-08 21:44:19.220 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.00 seconds
2024-10-08 21:44:19.220 INFO (MainThread) [homeassistant.setup] Setting up auth
2024-10-08 21:44:19.221 INFO (MainThread) [homeassistant.setup] Setup of domain auth took 0.00 seconds
2024-10-08 21:44:19.221 INFO (MainThread) [homeassistant.setup] Setting up config
2024-10-08 21:44:19.223 INFO (MainThread) [homeassistant.setup] Setup of domain config took 0.00 seconds
2024-10-08 21:44:19.223 INFO (MainThread) [homeassistant.setup] Setting up diagnostics
2024-10-08 21:44:19.224 INFO (MainThread) [homeassistant.setup] Setup of domain diagnostics took 0.00 seconds
2024-10-08 21:44:19.224 INFO (MainThread) [homeassistant.setup] Setting up file_upload
2024-10-08 21:44:19.224 INFO (MainThread) [homeassistant.setup] Setup of domain file_upload took 0.00 seconds
2024-10-08 21:44:19.224 INFO (MainThread) [homeassistant.setup] Setting up image_upload
2024-10-08 21:44:19.225 INFO (MainThread) [homeassistant.setup] Setup of domain image_upload took 0.00 seconds
2024-10-08 21:44:19.225 INFO (MainThread) [homeassistant.setup] Setting up repairs
2024-10-08 21:44:19.225 INFO (MainThread) [homeassistant.setup] Setup of domain repairs took 0.00 seconds
2024-10-08 21:44:19.225 INFO (MainThread) [homeassistant.setup] Setting up websocket_api
2024-10-08 21:44:19.225 INFO (MainThread) [homeassistant.setup] Setup of domain websocket_api took 0.00 seconds
2024-10-08 21:44:19.225 INFO (MainThread) [homeassistant.setup] Setting up api
2024-10-08 21:44:19.226 INFO (MainThread) [homeassistant.setup] Setup of domain api took 0.00 seconds
2024-10-08 21:44:19.226 INFO (MainThread) [homeassistant.setup] Setting up person
2024-10-08 21:44:19.227 INFO (MainThread) [homeassistant.setup] Setting up search
2024-10-08 21:44:19.227 INFO (MainThread) [homeassistant.setup] Setup of domain search took 0.00 seconds
2024-10-08 21:44:19.227 INFO (MainThread) [homeassistant.setup] Setup of domain person took 0.00 seconds
2024-10-08 21:44:19.227 INFO (MainThread) [homeassistant.setup] Setting up onboarding
2024-10-08 21:44:19.227 INFO (MainThread) [homeassistant.setup] Setup of domain onboarding took 0.00 seconds
2024-10-08 21:44:19.227 INFO (MainThread) [homeassistant.setup] Setting up lovelace
2024-10-08 21:44:19.228 INFO (MainThread) [homeassistant.setup] Setup of domain lovelace took 0.00 seconds
2024-10-08 21:44:19.228 INFO (MainThread) [homeassistant.setup] Setting up frontend
2024-10-08 21:44:19.230 INFO (MainThread) [homeassistant.setup] Setup of domain frontend took 0.00 seconds
2024-10-08 21:44:19.231 INFO (MainThread) [homeassistant.bootstrap] Setting up recorder: {'recorder'}
2024-10-08 21:44:19.231 INFO (MainThread) [homeassistant.setup] Setting up recorder
2024-10-08 21:44:19.233 INFO (MainThread) [homeassistant.components.http] Now listening on port 8123
2024-10-08 21:44:19.233 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.00 seconds
2024-10-08 21:44:19.273 INFO (MainThread) [homeassistant.setup] Setup of domain recorder took 0.04 seconds
2024-10-08 21:44:19.273 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 1: {'usb', 'websocket_api', 'api', 'network', 'repairs', 'zeroconf', 'http', 'bluetooth', 'auth', 'webhook', 'dhcp', 'ssdp', 'cloud'}
2024-10-08 21:44:19.274 INFO (MainThread) [homeassistant.setup] Setting up network
2024-10-08 21:44:19.276 INFO (MainThread) [homeassistant.setup] Setup of domain network took 0.00 seconds
2024-10-08 21:44:19.277 INFO (MainThread) [homeassistant.setup] Setting up webhook
2024-10-08 21:44:19.277 INFO (MainThread) [homeassistant.setup] Setup of domain webhook took 0.00 seconds
2024-10-08 21:44:19.292 INFO (MainThread) [homeassistant.setup] Setting up usb
2024-10-08 21:44:19.321 INFO (MainThread) [homeassistant.setup] Setup of domain usb took 0.03 seconds
2024-10-08 21:44:19.324 INFO (MainThread) [homeassistant.setup] Setting up zeroconf
2024-10-08 21:44:19.327 INFO (MainThread) [homeassistant.components.zeroconf] Starting Zeroconf broadcast
2024-10-08 21:44:19.327 INFO (MainThread) [homeassistant.setup] Setup of domain zeroconf took 0.00 seconds
2024-10-08 21:44:19.530 INFO (MainThread) [homeassistant.setup] Setting up dhcp
2024-10-08 21:44:19.530 INFO (MainThread) [homeassistant.setup] Setup of domain dhcp took 0.00 seconds
2024-10-08 21:44:19.562 INFO (MainThread) [homeassistant.setup] Setting up ssdp
2024-10-08 21:44:19.563 INFO (MainThread) [homeassistant.setup] Setup of domain ssdp took 0.00 seconds
2024-10-08 21:44:19.719 INFO (MainThread) [homeassistant.setup] Setting up cloud
2024-10-08 21:44:19.721 INFO (MainThread) [homeassistant.setup] Setting up ffmpeg
2024-10-08 21:44:19.721 INFO (MainThread) [homeassistant.setup] Setup of domain ffmpeg took 0.00 seconds
2024-10-08 21:44:19.721 INFO (MainThread) [homeassistant.setup] Setting up tts
2024-10-08 21:44:19.721 INFO (MainThread) [homeassistant.setup] Setup of domain cloud took 0.00 seconds
2024-10-08 21:44:19.723 INFO (MainThread) [homeassistant.setup] Setup of domain tts took 0.00 seconds
2024-10-08 21:44:19.777 INFO (MainThread) [homeassistant.setup] Setting up bluetooth
2024-10-08 21:44:19.792 INFO (MainThread) [homeassistant.setup] Setup of domain bluetooth took 0.01 seconds
2024-10-08 21:44:19.796 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'map', 'met', 'trace', 'assist_pipeline', 'tag', 'input_button', 'cast', 'logbook', 'default_config', 'diagnostics', 'automation', 'system_health', 'stream', 'wake_word', 'mobile_app', 'stt', 'google_translate', 'person', 'zone', 'application_credentials', 'timer', 'homeassistant_alerts', 'sun', 'file_upload', 'persistent_notification', 'shopping_list', 'ffmpeg', 'input_select', 'blueprint', 'conversation', 'my', 'hardware', 'search', 'device_automation', 'input_text', 'onboarding', 'counter', 'hacs', 'media_source', 'input_number', 'script', 'radio_browser', 'input_datetime', 'tts', 'history', 'intent', 'analytics', 'backup', 'energy', 'schedule', 'input_boolean', 'scene', 'image_upload', 'lovelace', 'config'}
2024-10-08 21:44:19.796 INFO (MainThread) [homeassistant.setup] Setting up wake_word
2024-10-08 21:44:19.797 INFO (MainThread) [homeassistant.setup] Setup of domain wake_word took 0.00 seconds
2024-10-08 21:44:19.797 INFO (MainThread) [homeassistant.setup] Setting up stt
2024-10-08 21:44:19.797 INFO (MainThread) [homeassistant.setup] Setup of domain stt took 0.00 seconds
2024-10-08 21:44:19.797 INFO (MainThread) [homeassistant.setup] Setting up scene
2024-10-08 21:44:19.798 INFO (MainThread) [homeassistant.setup] Setup of domain scene took 0.00 seconds
2024-10-08 21:44:19.798 INFO (MainThread) [homeassistant.setup] Setting up blueprint
2024-10-08 21:44:19.798 INFO (MainThread) [homeassistant.setup] Setup of domain blueprint took 0.00 seconds
2024-10-08 21:44:19.798 INFO (MainThread) [homeassistant.setup] Setting up trace
2024-10-08 21:44:19.798 INFO (MainThread) [homeassistant.setup] Setup of domain trace took 0.00 seconds
2024-10-08 21:44:19.798 INFO (MainThread) [homeassistant.setup] Setting up input_button
2024-10-08 21:44:19.799 INFO (MainThread) [homeassistant.setup] Setup of domain input_button took 0.00 seconds
2024-10-08 21:44:19.799 INFO (MainThread) [homeassistant.setup] Setting up logbook
2024-10-08 21:44:19.799 INFO (MainThread) [homeassistant.setup] Setup of domain logbook took 0.00 seconds
2024-10-08 21:44:19.799 INFO (MainThread) [homeassistant.setup] Setting up history
2024-10-08 21:44:19.799 INFO (MainThread) [homeassistant.setup] Setup of domain history took 0.00 seconds
2024-10-08 21:44:19.799 INFO (MainThread) [homeassistant.setup] Setting up media_source
2024-10-08 21:44:19.800 INFO (MainThread) [homeassistant.setup] Setup of domain media_source took 0.00 seconds
2024-10-08 21:44:19.800 INFO (MainThread) [homeassistant.setup] Setting up stream
2024-10-08 21:44:19.800 INFO (MainThread) [homeassistant.setup] Setting up automation
2024-10-08 21:44:19.801 INFO (MainThread) [homeassistant.setup] Setup of domain automation took 0.00 seconds
2024-10-08 21:44:19.801 INFO (MainThread) [homeassistant.setup] Setting up input_number
2024-10-08 21:44:19.802 INFO (MainThread) [homeassistant.setup] Setup of domain input_number took 0.00 seconds
2024-10-08 21:44:19.802 INFO (MainThread) [homeassistant.setup] Setting up system_health
2024-10-08 21:44:19.802 INFO (MainThread) [homeassistant.setup] Setup of domain system_health took 0.00 seconds
2024-10-08 21:44:19.802 INFO (MainThread) [homeassistant.setup] Setting up script
2024-10-08 21:44:19.804 INFO (MainThread) [homeassistant.setup] Setup of domain script took 0.00 seconds
2024-10-08 21:44:19.804 INFO (MainThread) [homeassistant.setup] Setting up zone
2024-10-08 21:44:19.805 INFO (MainThread) [homeassistant.setup] Setup of domain zone took 0.00 seconds
2024-10-08 21:44:19.805 INFO (MainThread) [homeassistant.setup] Setting up timer
2024-10-08 21:44:19.805 INFO (MainThread) [homeassistant.setup] Setup of domain timer took 0.00 seconds
2024-10-08 21:44:19.805 INFO (MainThread) [homeassistant.setup] Setting up input_boolean
2024-10-08 21:44:19.806 INFO (MainThread) [homeassistant.setup] Setup of domain input_boolean took 0.00 seconds
2024-10-08 21:44:19.806 INFO (MainThread) [homeassistant.setup] Setting up input_select
2024-10-08 21:44:19.806 INFO (MainThread) [homeassistant.setup] Setup of domain input_select took 0.00 seconds
2024-10-08 21:44:19.807 INFO (MainThread) [homeassistant.components.scene] Setting up homeassistant.scene
2024-10-08 21:44:19.835 INFO (MainThread) [homeassistant.setup] Setting up intent
2024-10-08 21:44:19.835 INFO (MainThread) [homeassistant.setup] Setup of domain intent took 0.00 seconds
2024-10-08 21:44:19.836 INFO (MainThread) [homeassistant.setup] Setting up conversation
2024-10-08 21:44:19.836 INFO (MainThread) [homeassistant.setup] Setup of domain conversation took 0.00 seconds
2024-10-08 21:44:19.836 INFO (MainThread) [homeassistant.setup] Setting up assist_pipeline
2024-10-08 21:44:19.836 INFO (MainThread) [homeassistant.setup] Setup of domain assist_pipeline took 0.00 seconds
2024-10-08 21:44:19.838 INFO (MainThread) [homeassistant.setup] Setting up map
2024-10-08 21:44:19.838 INFO (MainThread) [homeassistant.setup] Setup of domain map took 0.00 seconds
2024-10-08 21:44:19.839 INFO (MainThread) [homeassistant.setup] Setting up my
2024-10-08 21:44:19.839 INFO (MainThread) [homeassistant.setup] Setup of domain my took 0.00 seconds
2024-10-08 21:44:19.848 INFO (MainThread) [homeassistant.setup] Setting up met
2024-10-08 21:44:19.849 INFO (MainThread) [homeassistant.setup] Setup of domain met took 0.00 seconds
2024-10-08 21:44:19.853 INFO (MainThread) [homeassistant.setup] Setting up hardware
2024-10-08 21:44:19.870 INFO (MainThread) [homeassistant.setup] Setting up tag
2024-10-08 21:44:19.870 INFO (MainThread) [homeassistant.setup] Setup of domain tag took 0.00 seconds
2024-10-08 21:44:19.879 INFO (MainThread) [homeassistant.setup] Setting up input_text
2024-10-08 21:44:19.880 INFO (MainThread) [homeassistant.setup] Setup of domain input_text took 0.00 seconds
2024-10-08 21:44:19.881 INFO (MainThread) [homeassistant.setup] Setting up counter
2024-10-08 21:44:19.881 INFO (MainThread) [homeassistant.setup] Setup of domain counter took 0.00 seconds
2024-10-08 21:44:19.901 INFO (MainThread) [homeassistant.setup] Setting up energy
2024-10-08 21:44:19.901 INFO (MainThread) [homeassistant.setup] Setting up sensor
2024-10-08 21:44:19.901 INFO (MainThread) [homeassistant.setup] Setup of domain sensor took 0.00 seconds
2024-10-08 21:44:19.901 INFO (MainThread) [homeassistant.setup] Setup of domain energy took 0.00 seconds
2024-10-08 21:44:19.902 INFO (MainThread) [homeassistant.setup] Setup of domain hardware took 0.05 seconds
2024-10-08 21:44:19.908 INFO (MainThread) [homeassistant.setup] Setting up homeassistant_alerts
2024-10-08 21:44:19.909 INFO (MainThread) [homeassistant.setup] Setup of domain homeassistant_alerts took 0.00 seconds
2024-10-08 21:44:19.914 INFO (MainThread) [homeassistant.setup] Setup of domain stream took 0.11 seconds
2024-10-08 21:44:19.914 INFO (MainThread) [homeassistant.setup] Setting up sun
2024-10-08 21:44:19.915 INFO (MainThread) [homeassistant.setup] Setup of domain sun took 0.00 seconds
2024-10-08 21:44:19.916 INFO (MainThread) [homeassistant.components.sensor] Setting up sun.sensor
2024-10-08 21:44:19.965 INFO (MainThread) [homeassistant.setup] Setting up hacs
2024-10-08 21:44:19.965 INFO (MainThread) [homeassistant.setup] Setup of domain hacs took 0.00 seconds
2024-10-08 21:44:19.965 INFO (MainThread) [custom_components.hacs]
-------------------------------------------------------------------
HACS (Home Assistant Community Store)
Version: 2.0.1
This is a custom integration
If you have any issues with this you need to open an issue here:
https://github.com/hacs/integration/issues
-------------------------------------------------------------------
2024-10-08 21:44:19.970 INFO (MainThread) [custom_components.hacs] <HacsData restore> Restore started
2024-10-08 21:44:19.987 INFO (MainThread) [custom_components.hacs] <HacsData restore> Restore done
2024-10-08 21:44:19.988 INFO (MainThread) [custom_components.hacs] Enable category: integration
2024-10-08 21:44:19.988 INFO (MainThread) [custom_components.hacs] Enable category: plugin
2024-10-08 21:44:19.988 INFO (MainThread) [custom_components.hacs] Enable category: template
2024-10-08 21:44:19.988 INFO (MainThread) [custom_components.hacs] Enable category: theme
2024-10-08 21:44:20.022 INFO (MainThread) [homeassistant.setup] Setting up radio_browser
2024-10-08 21:44:20.022 INFO (MainThread) [homeassistant.setup] Setup of domain radio_browser took 0.00 seconds
2024-10-08 21:44:20.023 INFO (MainThread) [homeassistant.setup] Setting up input_datetime
2024-10-08 21:44:20.024 INFO (MainThread) [homeassistant.setup] Setup of domain input_datetime took 0.00 seconds
2024-10-08 21:44:20.025 INFO (MainThread) [homeassistant.setup] Setting up google_translate
2024-10-08 21:44:20.025 INFO (MainThread) [homeassistant.setup] Setup of domain google_translate took 0.00 seconds
2024-10-08 21:44:20.026 INFO (MainThread) [homeassistant.setup] Setting up application_credentials
2024-10-08 21:44:20.026 INFO (MainThread) [homeassistant.setup] Setup of domain application_credentials took 0.00 seconds
2024-10-08 21:44:20.032 INFO (MainThread) [homeassistant.setup] Setting up backup
2024-10-08 21:44:20.032 INFO (MainThread) [homeassistant.setup] Setup of domain backup took 0.00 seconds
2024-10-08 21:44:20.035 INFO (MainThread) [homeassistant.setup] Setting up schedule
2024-10-08 21:44:20.036 INFO (MainThread) [homeassistant.setup] Setup of domain schedule took 0.00 seconds
2024-10-08 21:44:20.037 INFO (MainThread) [homeassistant.setup] Setting up shopping_list
2024-10-08 21:44:20.037 INFO (MainThread) [homeassistant.setup] Setup of domain shopping_list took 0.00 seconds
2024-10-08 21:44:20.097 INFO (MainThread) [homeassistant.setup] Setting up cast
2024-10-08 21:44:20.098 INFO (MainThread) [homeassistant.setup] Setup of domain cast took 0.00 seconds
2024-10-08 21:44:20.180 INFO (MainThread) [homeassistant.setup] Setting up mobile_app
2024-10-08 21:44:20.180 INFO (MainThread) [homeassistant.setup] Setting up notify
2024-10-08 21:44:20.180 INFO (MainThread) [homeassistant.setup] Setup of domain notify took 0.00 seconds
2024-10-08 21:44:20.181 INFO (MainThread) [homeassistant.setup] Setup of domain mobile_app took 0.00 seconds
2024-10-08 21:44:20.181 INFO (MainThread) [homeassistant.components.notify] Setting up notify.mobile_app
2024-10-08 21:44:20.181 INFO (MainThread) [homeassistant.setup] Setting up default_config
2024-10-08 21:44:20.181 INFO (MainThread) [homeassistant.setup] Setup of domain default_config took 0.00 seconds
2024-10-08 21:44:20.184 INFO (MainThread) [homeassistant.components.sensor] Setting up energy.sensor
2024-10-08 21:44:20.186 INFO (MainThread) [homeassistant.setup] Setting up analytics
2024-10-08 21:44:20.186 INFO (MainThread) [homeassistant.setup] Setup of domain analytics took 0.00 seconds
2024-10-08 21:44:20.191 INFO (MainThread) [homeassistant.setup] Setting up switch
2024-10-08 21:44:20.191 INFO (MainThread) [homeassistant.setup] Setup of domain switch took 0.00 seconds
2024-10-08 21:44:20.191 INFO (MainThread) [homeassistant.components.switch] Setting up hacs.switch
2024-10-08 21:44:20.191 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.hacs entity: switch.tapo_controller_pre_release
2024-10-08 21:44:20.192 INFO (MainThread) [homeassistant.setup] Setting up update
2024-10-08 21:44:20.192 INFO (MainThread) [homeassistant.setup] Setup of domain update took 0.00 seconds
2024-10-08 21:44:20.192 INFO (MainThread) [homeassistant.components.update] Setting up hacs.update
2024-10-08 21:44:20.193 INFO (MainThread) [custom_components.hacs] Stage changed: setup
2024-10-08 21:44:20.193 INFO (MainThread) [custom_components.hacs] Stage changed: waiting
2024-10-08 21:44:20.193 INFO (MainThread) [custom_components.hacs] Setup complete, waiting for Home Assistant before startup tasks starts
2024-10-08 21:44:20.223 INFO (MainThread) [homeassistant.components.tts] Setting up google_translate.tts
2024-10-08 21:44:20.225 INFO (MainThread) [homeassistant.setup] Setting up todo
2024-10-08 21:44:20.227 INFO (MainThread) [homeassistant.setup] Setup of domain todo took 0.00 seconds
2024-10-08 21:44:20.227 INFO (MainThread) [homeassistant.components.todo] Setting up shopping_list.todo
2024-10-08 21:44:20.241 INFO (MainThread) [homeassistant.setup] Setting up media_player
2024-10-08 21:44:20.242 INFO (MainThread) [homeassistant.setup] Setup of domain media_player took 0.00 seconds
2024-10-08 21:44:20.243 INFO (MainThread) [homeassistant.components.media_player] Setting up cast.media_player
2024-10-08 21:44:20.756 INFO (MainThread) [homeassistant.setup] Setting up weather
2024-10-08 21:44:20.757 INFO (MainThread) [homeassistant.setup] Setup of domain weather took 0.00 seconds
2024-10-08 21:44:20.757 INFO (MainThread) [homeassistant.components.weather] Setting up met.weather
2024-10-08 21:44:20.881 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 1.87s
2024-10-08 21:44:20.882 INFO (MainThread) [homeassistant.core] Starting Home Assistant
2024-10-08 21:44:20.882 INFO (MainThread) [custom_components.hacs] Stage changed: startup
2024-10-08 21:44:20.883 DEBUG (MainThread) [custom_components.hacs] There are 6 scheduled recurring tasks
2024-10-08 21:44:20.883 INFO (MainThread) [custom_components.hacs] Loading removed repositories
2024-10-08 21:44:20.908 INFO (MainThread) [custom_components.hacs] Loading known repositories
2024-10-08 21:44:20.908 DEBUG (MainThread) [custom_components.hacs] Fetching updated content for theme
2024-10-08 21:44:20.909 DEBUG (MainThread) [custom_components.hacs] Fetching updated content for integration
2024-10-08 21:44:20.909 DEBUG (MainThread) [custom_components.hacs] Fetching updated content for plugin
2024-10-08 21:44:20.909 DEBUG (MainThread) [custom_components.hacs] Fetching updated content for template
2024-10-08 21:44:20.993 INFO (MainThread) [custom_components.hacs] Stage changed: running
2024-10-08 21:44:21.002 DEBUG (MainThread) [custom_components.hacs] <QueueManager> The queue is empty
2024-10-08 21:44:21.002 DEBUG (MainThread) [custom_components.hacs] <HACSStore async_save_to_store> Did not store data for 'hacs.critical'. Content did not change
2024-10-08 21:44:21.002 DEBUG (MainThread) [custom_components.hacs] Nothing in the queue
2024-10-08 21:44:21.012 INFO (SyncWorker_4) [homeassistant.loader] Loaded homekit_controller from homeassistant.components.homekit_controller
2024-10-08 21:44:21.012 INFO (SyncWorker_8) [homeassistant.loader] Loaded lifx from homeassistant.components.lifx
2024-10-08 21:44:21.012 INFO (SyncWorker_9) [homeassistant.loader] Loaded kegtron from homeassistant.components.kegtron
2024-10-08 21:44:21.012 INFO (SyncWorker_6) [homeassistant.loader] Loaded androidtv_remote from homeassistant.components.androidtv_remote
2024-10-08 21:44:21.013 INFO (SyncWorker_5) [homeassistant.loader] Loaded synology_dsm from homeassistant.components.synology_dsm
2024-10-08 21:44:21.048 INFO (SyncWorker_1) [homeassistant.loader] Loaded bluetooth_adapters from homeassistant.components.bluetooth_adapters
2024-10-08 21:44:21.060 INFO (SyncWorker_2) [homeassistant.loader] Loaded shelly from homeassistant.components.shelly
2024-10-08 21:44:21.094 INFO (SyncWorker_9) [homeassistant.loader] Loaded esphome from homeassistant.components.esphome
2024-10-08 21:44:21.133 INFO (SyncWorker_6) [homeassistant.loader] Loaded mqtt from homeassistant.components.mqtt
2024-10-08 21:44:21.151 INFO (SyncWorker_3) [homeassistant.loader] Loaded ruuvi_gateway from homeassistant.components.ruuvi_gateway
2024-10-08 21:44:21.441 INFO (MainThread) [homeassistant.setup] Setting up bluetooth_adapters
2024-10-08 21:44:21.445 INFO (SyncWorker_8) [homeassistant.loader] Loaded thread from homeassistant.components.thread
2024-10-08 21:44:25.835 ERROR (Thread-8) [pychromecast.socket_client] [Kitchen Speaker(90661d19-3142-1343-7243-6dae15279938.local.):8009] Failed to connect to service MDNSServiceInfo(name='Google-Nest-Mini-90661d193142134372436dae15279938._googlecast._tcp.local.'), retrying in 5.0s
2024-10-08 21:44:45.267 INFO (SyncWorker_0) [homeassistant.util.package] Attempting install of plugp100==5.1.3
2024-10-08 21:44:45.267 DEBUG (SyncWorker_0) [homeassistant.util.package] Running uv pip command: args=['uv', 'pip', 'install', '--quiet', 'plugp100==5.1.3', '--index-strategy', 'unsafe-first-match', '--upgrade', '--constraint', '/usr/src/homeassistant/homeassistant/package_constraints.txt', '--target', '/config/deps']
2024-10-08 21:44:52.375 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration tapo: No module named 'plugp100'
2024-10-08 21:54:20.884 DEBUG (MainThread) [custom_components.hacs] Nothing in the queue
2024-10-08 21:59:30.540 DEBUG (MainThread) [aiogithubapi] 'GitHubRateLimitResourcesModel' is missing key 'audit_log' for <class 'dict'>
2024-10-08 21:59:30.540 DEBUG (MainThread) [aiogithubapi] 'GitHubRateLimitResourcesModel' is missing key 'audit_log_streaming' for <class 'dict'>
2024-10-08 21:59:30.540 DEBUG (MainThread) [aiogithubapi] 'GitHubRateLimitResourcesModel' is missing key 'code_search' for <class 'dict'>
2024-10-08 22:04:20.886 DEBUG (MainThread) [custom_components.hacs] Nothing in the queue
Additional information
Reported to HACS https://github.com/hacs/integration/issues/4123 but was closed due to not being a HACS issue.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 21
- Comments: 79 (11 by maintainers)
Commits related to this issue
- Add PATHONPATH to env vars for hass https://github.com/home-assistant/core/issues/127966#issuecomment-2439414558 — committed to WolfeCub/home-ops by WolfeCub 2 years ago
- home-assistant: fix hass python dependency installation https://github.com/home-assistant/core/issues/127966 — committed to ascandella/dotfiles by ascandella 2 years ago
- Improve is docker env checks Check for the existence of the /run/.containerenv file. This file is created by podman (https://github.com/containers/podman/blob/v5.3.1/docs/source/markdown/podman-run.1... — committed to candrews/core-1 by candrews 2 years ago
- Improve is docker env checks Check for the existence of the /run/.containerenv file. This file is created by podman (https://github.com/containers/podman/blob/v5.3.1/docs/source/markdown/podman-run.1... — committed to candrews/core-1 by candrews 2 years ago
- create dummy .dockernv in root folder Workaround for https://github.com/home-assistant/core/issues/127966 — committed to bunnu/home-iac by bunnu 2 years ago
- Bump home-assistant/home-assistant from 2024.11.3 to 2024.12.1 in /homeassistant (#495) * Bump home-assistant/home-assistant in /homeassistant Bumps [home-assistant/home-assistant](https://github.... — committed to bunnu/home-iac by dependabot[bot] 2 years ago
- Add additional requirements for HACS addons Related to https://github.com/home-assistant/core/issues/127966 — committed to ravngr/homeassistant-config by ravngr 2 years ago
- Improve is docker env checks Check for the existence of the /run/.containerenv file. This file is created by podman (https://github.com/containers/podman/blob/v5.3.1/docs/source/markdown/podman-run.1... — committed to candrews/core-1 by candrews 2 years ago
- Fix python package handling in home assistant https://github.com/home-assistant/core/issues/127966 — committed to Skaronator/homelab by Skaronator 2 years ago
- Fix HACS modules loading See https://github.com/home-assistant/core/issues/127966#issuecomment-2539017518 — committed to prehor/home-ops by prehor 2 years ago
- Fix HACS modules loading See https://github.com/home-assistant/core/issues/127966#issuecomment-2539017518 — committed to prehor/home-ops by prehor 2 years ago
- Fix HACS modules loading See https://github.com/home-assistant/core/issues/127966#issuecomment-2539017518 — committed to prehor/home-ops by prehor 2 years ago
- Fix HACS modules loading See https://github.com/home-assistant/core/issues/127966#issuecomment-2539017518 — committed to prehor/home-ops by prehor 2 years ago
- Fix HACS modules loading See https://github.com/home-assistant/core/issues/127966#issuecomment-2539017518 — committed to prehor/home-ops by prehor 2 years ago
- Fix HACS modules loading See https://github.com/home-assistant/core/issues/127966#issuecomment-2539017518 — committed to prehor/home-ops by prehor 2 years ago
- Fix HACS modules loading See https://github.com/home-assistant/core/issues/127966#issuecomment-2539017518 — committed to prehor/home-ops by prehor 2 years ago
As a workaround I set
PYTHONPATHto/config/depsin the container’s environment so HASS can find and load the custom dependencies.That is incorrect, components installed through HACs and others can include that information in their manifest file. And this is evidenced by the information from OP about the logs referencing failing to install those modules.
With the latest HA itself, the PYTHONPATH broke start-up of the core.
I switched to mounting an empty
/.dockerenvfile into the container (I’m actually using podman, with the official HA container images) and that seems to work.Is it somehow possible to handle this fully in HA? I’m unsure why this workaround is necessary in the first place.
This is just bad container design. You should never assume that the container root survives a restart. If something needs to persist longer than the runtime of the container, it belongs into a volume/mount.
I don’t have any issues with the dependencies being re-installed when the version of HA or any of the dependencies itself change, but HA should handle that too, and not simply assume that the dependencies magically get wiped when the version changes. This could be as simple as a file containing the HA version in the persistent dependencies directory, used by HA to wipe the directory if the version doesn’t match the running one. This would result in the intended behaviour, without depending on the container root surving a restart.
Otherwise anyone using a container runtime that doesn’t simply restart old containers will have to build unnessecary workarounds, like building a custom image that needs to be updated for every single plugin or HA update. And simply saying K8s isn’t the way to run <x> is something a company distributing some propretary enterprise software would try to pull off, but just seems very inappropriate for a community project of this size.
I’m sure you will not like the answer, but maybe the way you run Home Assistant isn’t the best way in that case 🤷
I’d consider this the least intrusive workaround for k8s installations. Mounting
emptyDirto/.dockerenvworks for me:Thanks for the hint @rsteckler
You are anything but kind.
I submitted a PR that would fix this issue in HA: https://github.com/home-assistant/core/pull/132404
/var/run/secrets/kubernetes.io/...is not a fail-safe test for a Kubernetes environment. UsingautomountServiceAccountToken: falseis considered a good practice when an application does not need the k8s API access. In this case the complete directory structure is not populated. IMHO it would be good to not “enforce” the automatic mount.[var]/run/.containerenvis at least available forcri-o(https://github.com/cri-o/cri-o/issues/5461), but maybe not in other supported runtimes likecontainerd.Maybe a fallback environment variable would be nice to have, as I can set it manually in each environment if needed.
EDIT: Currently, the more viable test for a Kubernetes environment is using the default
KUBERNETES_*environment variables (e.g.KUBERNETES_PORT,KUBERNETES_SERVICE_PORT,KUBERNETES_SERVICE_HOST). These injections cannot be disabled easily.I’ve created a “What The Heck” thread on the forums in case that might help, as it seemed like an appropriate “what the heck” situation:
https://community.home-assistant.io/t/wth-is-going-on-with-docker-container-installs-and-third-party-integrations-that-need-python-modules/806430
+1 for this, worked for me… E.g… in Kubernetes deployment YAML (since this seems to affect mostly k8s users):
Probably something similar if you’re using Helm but I haven’t gotten into that yet.
Don’t know where and how the HACS dependencies were installed originally (prior to 2024.10), currently they are located in
/config/deps, which as per my understanding should be available in PATH for the libraries to be discoverable.The
sys.pathis updated through theasync_mount_local_lib_pathmethod: https://github.com/home-assistant/core/blob/a301d51fb2a69ce2b187a481d5cfa9b7cb30e453/homeassistant/bootstrap.py#L668-L676Which in turn uses
async_get_user_siteto retrieve paths: https://github.com/home-assistant/core/blob/06ea3a3014a0c2bdb162e723223e91489d90a48f/homeassistant/util/package.py#L133-L150The problem however is that
--user-siteargument inargs = [sys.executable, "-m", "site", "--user-site"]won’t return the path applied in thePYTHONUSERBASEenvironment variable, this is facilitated by the--user-basekey: https://docs.python.org/3.12/library/site.html#site.USER_BASEHence the path does not end up in PATH. That’s my understanding right now how the process works.
I just removed my work around, and upgraded to 2025.1, no problems so far! For me it’s working anyway. Thanks to the team for resolving this!
tl;dr for everyone else, in the meantime, here’s an updated workaround if you want deps installed in /config/deps (You must NOT be using the .dockerenv workaround because that causes HASS to install deps to the python library dir in /usr)
This command should resolve the correct lib path, create the directory structure, and replace the site-packages directory with a symlink to /config/deps, allowing home assistant to load all the dependencies that it installed to the wrong place.
If/when it gets fixed in the future, reverting this is basically
@MasseR this is coherent with what I observed as well.
uvinstalls dependencies in/config/depsas we can see from HA startup logs. But custom integrations seems to look for dependencies elsewhere, hence the issue.I can confirm symlinking
/config/deps/lib/python3.12/site-packagesto/config/depsfixes integration that were broken because of that (like mentioned in https://github.com/music-assistant/hass-music-assistant/issues/3031).Not sure where to look next to understand where those two diverging paths come from.
@mpreu I agree, I think the environment variable should be used to indicate that HA is running in the containerized environment. More over, this environment variable can be included in the HA dockerfile by default, so you don’t even need to set it on your own.
Updated to 2025.1 and having issues with custom components. Specifically https://github.com/jdeath/Hubspace-Homeassistant the error is different than the previous error but still does not seem to be working. I am running HomeAssistant via Kubernetes. Will create a new issue after I dig in a bit more but wanted to check if anyone else ran into this issue and has a fix.
I am not able to delete or re-add the integration either.
The simplest option, in my opinion, is to just volume map a random file to /.dockerenv Takes 10 seconds, survives reboots, doesn’t change any file contents or scripts, and can be backed out easily once this is fixed. It’s been working for me perfectly after I got frustrated with trying to change the python deps paths.
This issue rears its ugly head again with 2024.12 - it now uses Python 3.13, so anyone using the symlink workaround needs a new one that redirects
config/deps/lib/python3.13/site-packagestoconfig/deps.Has anyone come up with a permanent, future-proof fix? This is using the regular official Docker image with no unsupported extra things like Kubernetes, non-root, or any of the other things mentioned in this thread.
I’m encountering something similar - the problem seems to be that
/config/depsis not injected into the PYTHONPATH before thecustom_componentsare loaded.On my system I’ve been able to work around this by running Home Assistant docker with
PYTHONPATHforced to/config/depsbut this is clearly something has broken (maybe a dependency ordering issue? The async task for python path injection is happening after custom components load?)Thanks for this one!
For those who are using Kustomize, here you can find a patch file for this issues.
@Ulrar Could you give this a look? https://github.com/ruifung/rfhome-infrastructure/blob/master/deployments/pathweb/workloads/home-network/home-assistant/venv-run
You can use this script by mounting it over /etc/services.d/home-assistant/run
This should, in theory, confine all additional deps to a virtualenv, that is tied to a hash of the current state of packages present in the container image & the machine arch (assumption: this is a fresh env, as is common on kubernetes). This should, in theory, avoid any issues caused by stale dependencies by basically spinning up a new venv on every update, since that changes the hash of uv pip list.
If you would like to persist it, just mount a volume into /venv/
After some investigating, I think I found the reason why it’s not loading the dependencies installed into /config/deps
HASS tries to add /config/deps into sys.path using async_mount_local_lib_path. https://github.com/home-assistant/core/blob/a2ef1604af97bd0c16287adf41396f680b158eac/homeassistant/bootstrap.py#L324
But it uses async_get_user_site https://github.com/home-assistant/core/blob/a2ef1604af97bd0c16287adf41396f680b158eac/homeassistant/bootstrap.py#L676
Which resolves the actual user site-path using python3 -m site --user-site with USERBASEPATH set to /config/deps. This results in the path /config/deps/lib/python3.13/site-packages being injected into the sys.path. https://github.com/home-assistant/core/blob/a2ef1604af97bd0c16287adf41396f680b158eac/homeassistant/util/package.py#L169
The changes introduced in https://github.com/home-assistant/core/commit/d9812f0d48ac7c38a2404270bdbc7c81af534101 to emulate pip’s --user support with uv does not take into account the full path for the user-site, and thus installs all the deps directly into /config/deps instead of the expected /config/deps/lib/python3.13/site-packages https://github.com/home-assistant/core/blob/a2ef1604af97bd0c16287adf41396f680b158eac/homeassistant/util/package.py#L128
This results in a mismatch between what HASS expects it to be (the path injected into sys.path), and what it actually installs the additional dependencies into.
I’ve verified this by creating a symlink from /config/deps/lib/python3.12/site-packages -> /config/deps And it loads the dependencies properly. From what I’ve found, either fixing the UV --target to use the proper site-packages path as returned from the site module should allow /config/deps to be loaded properly when run (even if it’s not detected as docker.)
In fact, it would be preferable in K8S deployments for it not to detect as docker so it stores all the extra deps in the config dir instead of in /usr/.
@edenhaus I believe this is a bug in your fix for uv installing user site-packages?
Is there a way to finagle it to get it to store deps in /config/deps? Because having it require redownloading dependencies on every pod recreate is problematic for something that should run offline.
Yeah, it just should be documented, given that the official docs currently claim any OCI compatible runtime can be used.
Here’s my workaround using the /.dockerenv file creation. Given that the container uses s6-overlay, and the s6-overlay init is a shell script…
I just override the container’s entrypoint using this in my Pod spec. No need to build my own image, or do hostPath mounts (which are forbidden due to Pod Security standards on my namespaces)
Also no race conditions since it’s literally the first thing that runs before it chains to the s6 init.
A better solution might be to set the
PYTHONUSERBASE=/config/deps. Also, if you are running the container as a non-root user, add to your dockerfile the removal of the remaining lock in the/tmp/directory, i.e:You don’t have to use
writeText. You can use the shorthand relative path on the left side, nixos creates automatically a directory under/var/lib/For those using https://github.com/pajikos/home-assistant-helm-chart
I work around this issue like this in your
values.yamlI’ve mounted empty file to
/.dockerenvas a workaround in Kubernetes. But I still have some doubts that this is an optimal solution. Now/config/depsis empty and all dependencies are installed to/usr/local/lib/python3.12/site-packages/. But since this location is not persistent, it has to be re-installed every time container starts.As I run this in Kubernetes and have my configuration.yaml as a configmap, I’ve just mounted it a second time as .dockerenv and that also does the trick. As long as theres something called .dockerenv in / thats enough to pass the is_docker_env checks.
Thanks a lot @SphtKr !!!
Here a code snippet for those who have followed the gabe565 helm chart (e.g. via FluxCD):
Folks I did a bit more digging. There are 2 questions:
The reason why it’s not in the PATH is mentioned in my post above.
On the question 1, this logic is influenced by the factors like, is HA is running in docker or venv or some other type of environment. I faced the issue with OpenPlantBook extension, and while it was working perfectly well for some folks, I faced the issue due to the fact that my dependencies were installed in
/config/deps. While @slaxor505 and I are both running HA in contenerized environment, he uses docker and I use Kubernetes. And this makes a ton of difference, https://github.com/Olen/home-assistant-openplantbook/issues/32The packages are installed with
install_packagemethod, there is a bit of conditional logic there that appends--targetto the pip isntallation path: https://github.com/home-assistant/core/blob/a301d51fb2a69ce2b187a481d5cfa9b7cb30e453/homeassistant/util/package.py#L124-L137The method is called with a bunch of kwargs, that are generated within the
pip_kwargsmethod: https://github.com/home-assistant/core/blob/a301d51fb2a69ce2b187a481d5cfa9b7cb30e453/homeassistant/scripts/__init__.py#L54-L64In
pip_kwargsthere is a conditional logic that adds target parameter and as I mentioned above, it use venv / docker criteria. https://github.com/home-assistant/core/blob/487593af385fced4e15db84c8dbddc02c558ca23/homeassistant/requirements.py#L88-L97For instance
is_docker_envmethod: https://github.com/home-assistant/core/blob/cdf809926b01af7ae1c7595409be1e4c76ba9467/homeassistant/util/package.py#L30-L32So with that being said, we need to figure what fix is feasible - adding proper catalogs to path or dealing with package installation target.