alex-jung / home-assistant-vgn-component

Home Assistant custom component to get information about VGN departures like Bus, Train etc.
MIT License
1 stars 0 forks source link

500 Server error on Setup #5

Open McSlow opened 4 days ago

McSlow commented 4 days ago

Hi, just tried the 1.0.0. With an up to date HA it throws the following error when starting the config flow. Perhaps just a missing dependency... (see last line of dump...)

image

Logger: aiohttp.server
Quelle: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:448
Erstmals aufgetreten: 14:07:54 (1 Vorkommnisse)
Zuletzt protokolliert: 14:07:54

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 559, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 172, in post
    return await self._post_impl(request, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 179, in _post_impl
    return await super()._post_impl(request, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 84, in _post_impl
    result = await self._flow_mgr.async_init(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1301, in async_init
    flow, result = await self._async_init(flow_id, handler, context, data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1326, in _async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1518, in async_create_flow
    handler = await _async_get_flow_handler(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 3268, in _async_get_flow_handler
    await _load_integration(hass, domain, hass_config)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 3245, in _load_integration
    await async_process_deps_reqs(hass, hass_config, integration)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 575, in async_process_deps_reqs
    await requirements.async_get_integration_with_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 54, in async_get_integration_with_requirements
    return await manager.async_get_integration_with_requirements(domain)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 170, in async_get_integration_with_requirements
    await future
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 159, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 182, in _async_process_integration
    await self.async_process_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 269, in async_process_requirements
    await self._async_process_requirements(name, missing)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 307, in _async_process_requirements
    raise RequirementsNotFound(name, list(failures))
homeassistant.requirements.RequirementsNotFound: Requirements for vgn_departures not found: ['polars==1.12.0'].
alex-jung commented 4 days ago

I can reproduce the issue on my ha instance too. It looks like an internal Home Assistent issue...I will search for a solution

McSlow commented 3 days ago

What I saw is that you require some stuff which is already required in core. ( aiodns ). Perhaps then it stops pulling the rest using pip. https://developers.home-assistant.io/docs/creating_integration_manifest/#custom-integration-requirements https://github.com/home-assistant/core/blob/dev/requirements.txt

alex-jung commented 3 days ago

What I saw is that you require some stuff which is already required in core. ( aiodns ). Perhaps then it stops pulling the rest using pip. https://developers.home-assistant.io/docs/creating_integration_manifest/#custom-integration-requirements https://github.com/home-assistant/core/blob/dev/requirements.txt

hm, I don't have "aiodns" in my requirements ;-) only this packages: "async-lru==2.0.4", "polars==1.12.0", "aiopath==0.7.7", "aiofiles==24.1.0", "aioshutil==1.5"

I checked them already, no one of them is in the requirements.txt

Probably the issue is with some missing permissions in home assistant environment:

2024-11-18 16:33:52.517 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package polars==1.12.0: error: Failed to prepare distributions
  Caused by: Failed to download and build `polars==1.12.0`
  Caused by: Build backend failed to build wheel through `build_wheel` (exit status: 1)

[stdout]
Running `maturin pep517 build-wheel -i /tmp/.tmpsuZyol/builds-v0/.tmp5WEUKR/bin/python --compatibility off`

[stderr]
Traceback (most recent call last):
  File "<string>", line 11, in <module>
  File "/tmp/.tmpsuZyol/builds-v0/.tmp5WEUKR/lib/python3.12/site-packages/maturin/__init__.py", line 119, in build_wheel
    return _build_wheel(wheel_directory, config_settings, metadata_directory)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/.tmpsuZyol/builds-v0/.tmp5WEUKR/lib/python3.12/site-packages/maturin/__init__.py", line 100, in _build_wheel
    result = subprocess.run(command, stdout=subprocess.PIPE)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.12/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'maturin'
2024-11-18 16:33:58.027 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package polars==1.12.0: error: Failed to prepare distributions

I created an issue in core github repository, let's see.

McSlow commented 3 days ago

Ah sorry, don't know how i got over that aiodns package.

I just tried to install polars using pip inside the core container manually. btw: if you do a pip list there, it seems all other deps are there, e.g. aiopath is on 0.7.7.

seems that compilation struggles because of the missing cargo/rust framework:

/config # pip install polars==1.12.0
Looking in indexes: https://pypi.org/simple, https://wheels.home-assistant.io/musllinux-index/
Collecting polars==1.12.0
  Downloading polars-1.12.0.tar.gz (4.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.1/4.1 MB 37.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]

      Cargo, the Rust package manager, is not installed or is not on PATH.
      This package requires Rust and Cargo to compile extensions. Install it through
      the system's package manager or via https://rustup.rs/

      Checking for Rust toolchain....
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

Edit: just saw that maturin just takes care about that rust stuff and builds it. But it might at least be the reason why just this package fails, all the others might just be installed as usual.

alex-jung commented 3 days ago

the same issue on my raspberry pi (hassio), but no problem on virtual machine in docker container :(

alex-jung commented 3 days ago

Just tried it out on other raspberry pi server without Hass.io (only home assistant core installed) -> it works without any issues. Is your HA running on Hass.io?

McSlow commented 3 days ago

Yes, hass.io.

alex-jung commented 3 days ago

I tested it with Docker containers (stable and dev). Both containers raised this exceptions...something is missing or wrong in containers