Open tbrasser opened 2 weeks ago
for me, updating HA to 2024.11.0 resolves the issue
I'm on 2024.11.0 docker image, Similar issue with 5.4.1 upgrade, in my case 'hass_web_proxy_lib' is not found at all
Setup failed for custom integration 'frigate': Unable to import component: No module named 'hass_web_proxy_lib'
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/frigate/__init__.py", line 57, in <module>
from .views import async_setup as views_async_setup
File "/config/custom_components/frigate/views.py", line 11, in <module>
from hass_web_proxy_lib import (
ModuleNotFoundError: No module named 'hass_web_proxy_lib'
@lezruk I would expect that to be installed automatically. Have you tried downing / upping your HA instance?
5.4.1 integration I updated once it popped up in HACS, HASS updated automatically, just today updated HASS to 2024.11.1 - same behaviour - 'hass_web_proxy_lib' load issue. Downgrading to 5.4.0 works fine though
FYI: I just tested this by updating the Frigate integration via HACS to v5.4.1
, upping/downing Home Assistant, and the library was automatically installed and the integration setup correctly without problem as expected. As such, for people experiencing this issue, I'm not sure what we're doing differently, perhaps try entirely down the docker container and up it again (for docker users).
HA was 2024.10.x Upgraded Frigate on HACS to 5.4.1 Restarted HA Saw the error and assumed I needed to update HA, so upgraded HA to 2024.11.1 Restarted HA Continued to have the error despite bouncing HA multiple times Finally downgraded Frigate on HACS to 5.4.0 and it's working again
@rsteckler Are you using HA in a docker container, or HAOS? Is there anything in your HA log, shortly after startup, about trying to install the dependency (search for hass-web-proxy-lib
).
I'm running in a kubernetes environment, but it's essentially docker.
And yes - sorry for the lack of specificity. When I said "the error" in my previous post, I meant the same error as the other posts (i.e. a failed dependency on hass-web-proxy-lib)
I meant the same error as the other posts (i.e. a failed dependency on hass-web-proxy-lib)
Would you mind searching for hass-web-proxy-lib
in your HA logfile and paste anything you find that references it?
Upgraded back to 5.4.1 and restarted. Here are the logs, including some other content that might be related.
Thanks @rsteckler . Not really conclusive, still can't figure out why the package is not being installed for you. If you are comfortable doing so, would you mind logging in to your HA instance via ssh / docker exec and running:
pip install hass-web-proxy-lib==0.0.6
This is what Home Assistant should be running to install the dependency, I'm trying to figure out if there's some subset of users / scenarios in which that doesn't work ... or whether HA is just not trying to install it.
(Doesn't matter whether you're running 5.4.0
or 5.4.1
when you do this, I just want to see if it can be installed)
Sure - happy to help.
Upgraded again to 5.4.1. Verified the error exists in the logs still. Logged into the pod and here's the output:
At that point the frigate integration was not loaded and didn't have a "reload" option in HA. I restarted HA and this time there's no error in the logs and the Frigate installation loaded successfully.
If you're unable to repro on your side and have any hypotheses on why it might be failing on some machines, I'm happy to remove the hass-web-proxy-lib package and tail some logs or something while HA is starting up. One would assume it's logging something, somewhere when it should attempt to run the pip install.
For now, appreciate having it upgraded. Thanks for the workaround!
Thanks @rsteckler , that's really helpful. I have (currently) no idea why HA would not install the requirements. You have proven they work, but HA isn't trying to install them ...
According to the faq HA installs dependencies in /config/deps (this is persistent volume for containerized setup) , and I can see it there, even if manually deleted it pulls it back upon container restart. By saying that, it looks like integration doesn't find/search module in /config/deps but instead in pip default location - /usr/local/lib/python3.12/site-packages. That explains why manual install with pip works. Unfortunately /usr/local/ won;t survive container restart and module needs to be located in /config/deps instead
home-assistant-69c7fc799b-g55dg:/config/deps# ls -la | grep web
drwxr-xr-x 3 root root 5 Nov 8 17:41 hass_web_proxy_lib
drwxr-xr-x 2 root root 8 Nov 8 17:41 hass_web_proxy_lib-0.0.6.dist-info
Yeah something is/was up with uv
and path in core.
I'm hitting the same high level error, but with possibly different logs relating to psutil
install failing because of gcc
missing:
As with the previous comments, pip install hass-web-proxy-lib==0.0.6
runs successfully when shelled into the home assistant Kubernetes pod.
By saying that, it looks like integration doesn't find/search module in /config/deps but instead in pip default location - /usr/local/lib/python3.12/site-packages.
The integration does not control (nor should set) the module search path, Home Assistant does and this is supposed to "just work" (and does for me, both in a test install and in the devcontainer).
A few ideas:
<3.12
, as the library is only available for >=3.12
. Having said that, that really should not be the case as recent releases of HA also run on 3.12
.2024.11.1
)./usr/local...
Unfortunately /usr/local/ won;t survive container restart and module needs to be located in /config/deps instead
I strongly suspect this depends on the install type. Using the official Home Assistant docker image, /usr/local
will absolutely survive container restart (this is where Home Assistant installs its dependencies including this one, and /config/deps
is not used).
I'm not a python dev and don't know the HA system well, so this might not be well-informed, but....
Responding to your hypothesis on python version:
Python 3.12.4 (main, Jun 22 2024, 12:49:21) [GCC 13.2.1 20240309] on linux
Also, pip show
looks similar between a package installed by another HACS component:
node-nuc-hassio:/config# pip show xiaomi-ble
Name: xiaomi-ble
Version: 0.33.0
Summary: Manage Xiaomi BLE devices
Home-page: https://github.com/bluetooth-devices/xiaomi-ble
Author: John Carr
Author-email: john.carr@unrouted.co.uk
License: Apache-2.0
Location: /usr/local/lib/python3.12/site-packages
Requires: aiohttp, bleak, bleak-retry-connector, bluetooth-data-tools, bluetooth-sensor-state-data, cryptography, home-assistant-bluetooth, orjson, pycryptodomex, sensor-state-data
Required-by:
and...
node-nuc-hassio:/config# pip show hass-web-proxy-lib
Name: hass-web-proxy-lib
Version: 0.0.6
Summary: A library to proxy web traffic through Home Assistant integrations.
Home-page: https://github.com/dermotduffy/hass-web-proxy-lib
Author: Dermot Duffy
Author-email: dermot.duffy@gmail.com
License: MIT
Location: /usr/local/lib/python3.12/site-packages
Requires: homeassistant
Required-by:
Also:
node-nuc-hassio:/config# whoami
root
I know none of these really helps towards a solution, but lmk if you need anything from a broken system.
One more interesting thing (at least to me, who has no idea what I'm doing)
It looks like HA is trying to install the package, specifically into /config/deps
node-nuc-hassio:/config# grep "homeassistant.util.package" home-assistant.log
2024-11-12 05:17:03.609 INFO (SyncWorker_1) [homeassistant.util.package] Attempting install of hass-web-proxy-lib==0.0.6
2024-11-12 05:17:03.609 DEBUG (SyncWorker_1) [homeassistant.util.package] Running uv pip command: args=['/usr/local/bin/python3', '-m', 'uv', 'pip', 'install', '--quiet', 'hass-web-proxy-lib==0.0.6', '--index-strategy', 'unsafe-first-match', '--upgrade', '--constraint', '/usr/src/homeassistant/homeassistant/package_constraints.txt', '--target', '/config/deps']
When I run the command it runs, it audits 91 packages, seeing that hass-web-proxy-url is correctly installed in the /config/deps directory.
But it's not shown as 'installed' by pip:
node-nuc-hassio:/config# pip show hass-web-proxy-lib
WARNING: Package(s) not found: hass-web-proxy-lib
Here it is in the /config/deps directory:
node-nuc-hassio:/config# ls -al /config/deps/hass_web_proxy_lib*
/config/deps/hass_web_proxy_lib:
total 32
drwxr-xr-x 3 root root 4096 Nov 10 05:49 .
drwxr-xr-x 227 root root 12288 Nov 12 05:27 ..
-rw-r--r-- 1 root root 10523 Nov 10 05:49 __init__.py
-rw-r--r-- 1 root root 0 Nov 10 05:49 py.typed
drwxr-xr-x 2 root root 4096 Nov 10 05:49 tests
/config/deps/hass_web_proxy_lib-0.0.6.dist-info:
total 44
drwxr-xr-x 2 root root 4096 Nov 10 05:49 .
drwxr-xr-x 227 root root 12288 Nov 12 05:27 ..
-rw-r--r-- 1 root root 2 Nov 10 05:49 INSTALLER
-rw-r--r-- 1 root root 1109 Nov 10 05:49 LICENSE
-rw-r--r-- 1 root root 9116 Nov 10 05:49 METADATA
-rw-r--r-- 1 root root 1076 Nov 10 05:49 RECORD
-rw-r--r-- 1 root root 0 Nov 10 05:49 REQUESTED
-rw-r--r-- 1 root root 88 Nov 10 05:49 WHEEL
In this scenario, HA fails to load the frigate integration but happily checks hass-web-proxy-lib is installed exactly where it wants it to be.
Running pip install hass-web-proxy-lib
puts it in /usr/local, which allows it to be found by HA/Frigate at startup.
My guess, again knowing nothing about python, is that the frigate integration is trying to import the proxy library from the pip system path, rather than from /config/deps.
I'm also guessing it's working on your machine because you have it installed there, or your version of HA is using the system pip path instead of /config/deps.
Hope something in there helps.
My guess, again knowing nothing about python, is that the frigate integration is trying to import the proxy library from the pip system path, rather than from /config/deps.
The Frigate integration does not control the search path for modules. It simply tells HA "Please install dependency X" and then tries to import it from the module path (that is also controlled by HA and/or the system configuration).
I suspect this is actually a Home Assistant issue, perhaps this one: https://github.com/home-assistant/core/issues/127966 . There's also a workaround linked you could try.
Good find. I agree that's exactly the problem and, as mentioned in the other thread, I'm running in a kunernetes environment.
It looks like there's a workaround in that thread for non-docker container environments that I'll use to verify.
Just confirming that the kubernetes solution in the other thread solves this. I would close this as an upstream issue and point people there.
Unable to install package hass-web-proxy-lib==0.0.6: × No solution found when resolving dependencies: ╰─▶ Because homeassistant>=2024.10.3,<=2024.10.4 depends on yarl==1.13.1 and yarl==1.17.2, we can conclude that homeassistant>=2024.10.3,<=2024.10.4 cannot be used. And because only the following versions of homeassistant are available: homeassistant<=2024.10.4 homeassistant>=2024.11.0 we can conclude that homeassistant>=2024.10.3,<2024.11.0 cannot be used. (1) Because homeassistant>=2024.11.0 depends on webrtc-models==0.2.0 and webrtc-models==0.3.0, we can conclude that homeassistant>=2024.11.0 cannot be used. And because we know from (1) that homeassistant>=2024.10.3,<2024.11.0 cannot be used, we can conclude that homeassistant>=2024.10.3 cannot be used. And because hass-web-proxy-lib==0.0.6 depends on homeassistant>=2024.10.3 and you require hass-web-proxy-lib==0.0.6, we can conclude that your requirements are unsatisfiable. hint: Pre-releases are available for homeassistant in the requested range (e.g., 2024.11.0b9), but pre-releases weren't enabled (try: --prerelease=allow
)
This is the error i get when looking through logs. I have tried the PYTONPATCH environment variable but it doesn't work i am on the dev version of homeassistant version: 2024.12.0.dev202411190233
@awptechnologies Not sure, but guessing that because you're using an unreleased HomeAssistant version, there's not yet a HA library that's been released that matches the required dependencies. If this is right, you can just wait for the HA team to do a library release, or change to an official HA version (and not 2024.12.0.dev202411190233
).
@awptechnologies Rethinking this -- I think this library that hass-web-proxy-lib
depends on should not be a runtime dependency at all, which would help with this case. I'll investigate this...
@awptechnologies Can you try to latest v5.5.0 pre-release. I hope it will help your specific problem. (Won't change anything for anyone else who is impacted with the HA-wide import issue as discussed earlier in this thread)
5.5.0 works great thanks.
Version of the custom_component
5.4.1
Configuration
Describe the bug
A clear and concise description of what the bug is.
Debug log