I’m trying to support the development of a custom component, but for some reason I fail to handle Python dependencies. They are in manifest.json, are installed but I still see No module named 'xcomfort'
and encounter a failure.
manifest.json looks like this:
{
"domain": "xcomfort_bridge",
"name": "Eaton xComfort Bridge",
"version": "0.1.2",
"config_flow": true,
"documentation": "https://github.com/jankrib/ha-xcomfort-bridge",
"issue_tracker": "https://github.com/jankrib/ha-xcomfort-bridge/issues",
"requirements": [
"xcomfort==0.1.2",
"rx==3.0.1",
"pycryptodome==3.15.0"
],
"system_packages": true,
"ssdp": [],
"zeroconf": [],
"homekit": {},
"dependencies": [],
"codeowners": [
"@jankrib"
]
}
Using: ghcr.io/home-assistant/home-assistant:latest
, I can see that they are installed to /config/deps when I try to add the component.
Debug logs:
2024-11-09 07:58:10.887 INFO (SyncWorker_50) [homeassistant.util.package] Attempting install of xcomfort==0.1.2
2024-11-09 07:58:10.888 DEBUG (SyncWorker_50) [homeassistant.util.package] Running uv pip command: args=['/usr/local/bin/python3', '-m', 'uv', 'pip', 'install', '--quiet', 'xcomfort==0.1.2', '--index-strategy', 'unsafe-first-match', '--upgrade', '--constraint', '/usr/src/homeassistant/homeassistant/package_constraints.txt', '--target', '/config/deps']
2024-11-09 07:58:12.317 INFO (SyncWorker_50) [homeassistant.util.package] Attempting install of rx==3.0.1
2024-11-09 07:58:12.317 DEBUG (SyncWorker_50) [homeassistant.util.package] Running uv pip command: args=['/usr/local/bin/python3', '-m', 'uv', 'pip', 'install', '--quiet', 'rx==3.0.1', '--index-strategy', 'unsafe-first-match', '--upgrade', '--constraint', '/usr/src/homeassistant/homeassistant/package_constraints.txt', '--target', '/config/deps']
2024-11-09 07:58:12.631 INFO (SyncWorker_50) [homeassistant.util.package] Attempting install of pycryptodome==3.15.0
2024-11-09 07:58:12.631 DEBUG (SyncWorker_50) [homeassistant.util.package] Running uv pip command: args=['/usr/local/bin/python3', '-m', 'uv', 'pip', 'install', '--quiet', 'pycryptodome==3.15.0', '--index-strategy', 'unsafe-first-match', '--upgrade', '--constraint', '/usr/src/homeassistant/homeassistant/package_constraints.txt', '--target', '/config/deps']
2024-11-09 07:58:13.114 DEBUG (MainThread) [homeassistant.loader] Importing platforms for xcomfort_bridge executor=['config_flow'] loop=[] took 0.00s
2024-11-09 07:58:13.115 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration xcomfort_bridge: No module named 'xcomfort'
I can see that xcomfort
is installed in /config/deps, but not loaded. So I expect it’s not in $PYTHONPATH
.
ls custom_components/ deps/
custom_components/:
xcomfort_bridge
deps/:
aiohappyeyeballs attrs multidict-6.1.0.dist-info Rx-3.0.1.dist-info
aiohappyeyeballs-2.4.3.dist-info attrs-24.2.0.dist-info multidict.libs xcomfort
aiohttp Crypto propcache xcomfort-0.1.2.dist-info
aiohttp-3.10.10.dist-info frozenlist propcache-0.2.0.dist-info yarl
aiohttp.libs frozenlist-1.5.0.dist-info propcache.libs yarl-1.17.1.dist-info
aiosignal idna pycryptodome-3.15.0.dist-info yarl.libs
aiosignal-1.3.1.dist-info idna-3.10.dist-info pycryptodome.libs
attr multidict rx
I’ve added a logging statement in the custom component __init__.py
to confirm and found that indeed /deps/config
is not in the Python path.
2024-11-09 08:55:13.136 INFO (ImportExecutor_0) [custom_components.xcomfort_bridge] Python path: ['/config/deps/lib/python3.12/site-packages', '/config', '/usr/local/lib/python312.zip', '/usr/local/lib/python3.12', '/usr/local/lib/python3.12/lib-dynload', '/usr/local/lib/python3.12/site-packages', '__editable__.homeassistant-2024.11.1.finder.__path_hook__']
Not sure how this should work for custom components, any guidance would be appreciated here.