home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.57k stars 30.35k forks source link

2024.10.0 HA core doesn't find uv #127359

Open 00svd00 opened 1 week ago

00svd00 commented 1 week ago

The problem

After upgrade from previous verison got LOTS of errors like this

2024-10-02 23:12:32.892 ERROR (MainThread) [homeassistant.bootstrap] Error setting up integration frontend - received exception
Traceback (most recent call last):
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/setup.py", line 185, in async_setup_component
    await future
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/setup.py", line 185, in async_setup_component
    await future
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/setup.py", line 165, in async_setup_component
    result = await _async_setup_component(hass, domain, config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/setup.py", line 326, in _async_setup_component
    await async_process_deps_reqs(hass, config, integration)
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/setup.py", line 575, in async_process_deps_reqs
    await requirements.async_get_integration_with_requirements(
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 54, in async_get_integration_with_requirements
    return await manager.async_get_integration_with_requirements(domain)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 170, in async_get_integration_with_requirements
    await future
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 159, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 182, in _async_process_integration
    await self.async_process_requirements(
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 269, in async_process_requirements
    await self._async_process_requirements(name, missing)
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 301, in _async_process_requirements
    installed, failures = await self.hass.async_add_executor_job(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 115, in _install_requirements_if_missing
    if pkg_util.is_installed(req) or _install_with_retry(req, kwargs):
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 103, in _install_with_retry
    if pkg_util.install_package(requirement, **kwargs):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/util/package.py", line 140, in install_package
    with Popen(
         ^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'uv'

Main page returns 404: Not Found uv component is installed

pip3 install uv
Requirement already satisfied: uv in /opt/homeassistant/lib/python3.12/site-packages (0.4.15)

What version of Home Assistant Core has the issue?

2024.10.0

What was the last working version of Home Assistant Core?

2024.9.3

What type of installation are you running?

Home Assistant Core

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

hafnerra commented 1 week ago

Same Problem here

centertivevier commented 1 week ago

I get the same error after an upgrade to 2024.10.0

2024-10-02 21:39:41.233 ERROR (MainThread) [homeassistant.bootstrap] Error setting up integration frontend - received exception
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/setup.py", line 185, in async_setup_component
    await future
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/setup.py", line 185, in async_setup_component
    await future
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/setup.py", line 165, in async_setup_component
    result = await _async_setup_component(hass, domain, config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/setup.py", line 326, in _async_setup_component
    await async_process_deps_reqs(hass, config, integration)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/setup.py", line 575, in async_process_deps_reqs
    await requirements.async_get_integration_with_requirements(
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 54, in async_get_integration_with_requirements
    return await manager.async_get_integration_with_requirements(domain)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 170, in async_get_integration_with_requirements
    await future
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 159, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 182, in _async_process_integration
    await self.async_process_requirements(
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 269, in async_process_requirements
    await self._async_process_requirements(name, missing)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 301, in _async_process_requirements
    installed, failures = await self.hass.async_add_executor_job(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 115, in _install_requirements_if_missing
    if pkg_util.is_installed(req) or _install_with_retry(req, kwargs):
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 103, in _install_with_retry
    if pkg_util.install_package(requirement, **kwargs):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/util/package.py", line 140, in install_package
    with Popen(
         ^^^^^^
  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)
FileNotFoundError: [Errno 2] No such file or directory: 'uv'

"uv" is installed from the dependency. A Downgrade to 2024.9.3 solve the problem.

prairiesnpr commented 1 week ago

If you use systemd, add the path to the environment.

[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=%i
WorkingDirectory=/home/%i/.homeassistant
ExecStart=/srv/homeassistant/bin/hass -c  "/home/%i/.homeassistant"
Environment="PATH=/srv/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/homeassistant/.local/bin"
RestartForceExitStatus=100
Restart=on-failure

[Install]
WantedBy=multi-user.target
zanezam commented 1 week ago

And also same problem for me (FileNotFoundError: [Errno 2] No such file or directory: 'uv') when upgrading from 2024.9.3 -> 2024.10.0

hafnerra commented 1 week ago

If you use systemd, add the path to the environment.

[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=%i
WorkingDirectory=/home/%i/.homeassistant
ExecStart=/srv/homeassistant/bin/hass -c  "/home/%i/.homeassistant"
Environment="PATH=/srv/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/homeassistant/.local/bin"
RestartForceExitStatus=100
Restart=on-failure

[Install]
WantedBy=multi-user.target

Thx, now home assistant frontend starts

zanezam commented 1 week ago

And also same problem for me (FileNotFoundError: [Errno 2] No such file or directory: 'uv') when upgrading from 2024.9.3 -> 2024.10.0

If you use systemd, add the path to the environment.

[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=%i
WorkingDirectory=/home/%i/.homeassistant
ExecStart=/srv/homeassistant/bin/hass -c  "/home/%i/.homeassistant"
Environment="PATH=/srv/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/homeassistant/.local/bin"
RestartForceExitStatus=100
Restart=on-failure

[Install]
WantedBy=multi-user.target

yeah that indeed fixed it for me too. Thanks!

centertivevier commented 1 week ago

Thanks. The frontend start.

billyburly commented 1 week ago

After installing uv on my system I get the following errors and am still stuck at the Recovery Mode screen

2024-10-02 17:24:41.608 ERROR (SyncWorker_9) [homeassistant.util.package] Unable to install package home-assistant-frontend==20241002.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:41.782 ERROR (SyncWorker_9) [homeassistant.util.package] Unable to install package home-assistant-frontend==20241002.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:41.955 ERROR (SyncWorker_9) [homeassistant.util.package] Unable to install package home-assistant-frontend==20241002.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:41.955 ERROR (MainThread) [homeassistant.setup] Setup failed for 'frontend': Requirements for frontend not found: ['home-assistant-frontend==20241002.2'].
2024-10-02 17:24:42.130 ERROR (SyncWorker_10) [homeassistant.util.package] Unable to install package python-matter-server==6.5.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:42.303 ERROR (SyncWorker_10) [homeassistant.util.package] Unable to install package python-matter-server==6.5.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:42.477 ERROR (SyncWorker_10) [homeassistant.util.package] Unable to install package python-matter-server==6.5.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:42.652 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package home-assistant-intents==2024.10.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:42.825 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package home-assistant-intents==2024.10.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:42.998 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package home-assistant-intents==2024.10.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:42.998 ERROR (MainThread) [homeassistant.setup] Setup failed for 'cloud': Requirements for conversation not found: ['home-assistant-intents==2024.10.2'].
2024-10-02 17:24:42.998 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of 'recovery_mode'. Setup failed for dependencies: ['frontend', 'cloud']
2024-10-02 17:24:42.999 ERROR (MainThread) [homeassistant.setup] Setup failed for 'recovery_mode': Could not setup dependencies: frontend, cloud
basilfx commented 1 week ago

If you use systemd, add the path to the environment.

Eventually, this worked for me. It was unclear to me which PATH to add, but it was sufficient to add the /path/to/env/bin folder in my case (where env is a virtual environment).

...
Environment="PATH=/opt/apps/homeassistant/env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
...
svenf01 commented 1 week ago

Hi, Same for me. HASSIO with HomeAssistant after 24.09.03 to 24.10 frontend not starting up. Where I can fine the place/file to make the modifications? My SAMBA to Config-Filter is working. But I think that is the wrong place.

edenhaus commented 1 week ago

@svenf01 You should not have the issue with HASSIO as uv will be available in the container. Please get the logs and create a new issue, and your one is different from the reported one here.

edenhaus commented 1 week ago

Uv will be installed automatically during the installation of the home assistant. The user needs to make sure that the venv is activated or the PATH variable includes binaries installed wth python pip

edenhaus commented 1 week ago

After installing uv on my system I get the following errors and am still stuck at the Recovery Mode screen

2024-10-02 17:24:41.608 ERROR (SyncWorker_9) [homeassistant.util.package] Unable to install package home-assistant-frontend==20241002.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:41.782 ERROR (SyncWorker_9) [homeassistant.util.package] Unable to install package home-assistant-frontend==20241002.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:41.955 ERROR (SyncWorker_9) [homeassistant.util.package] Unable to install package home-assistant-frontend==20241002.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:41.955 ERROR (MainThread) [homeassistant.setup] Setup failed for 'frontend': Requirements for frontend not found: ['home-assistant-frontend==20241002.2'].
2024-10-02 17:24:42.130 ERROR (SyncWorker_10) [homeassistant.util.package] Unable to install package python-matter-server==6.5.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:42.303 ERROR (SyncWorker_10) [homeassistant.util.package] Unable to install package python-matter-server==6.5.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:42.477 ERROR (SyncWorker_10) [homeassistant.util.package] Unable to install package python-matter-server==6.5.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:42.652 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package home-assistant-intents==2024.10.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:42.825 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package home-assistant-intents==2024.10.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:42.998 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package home-assistant-intents==2024.10.2: error: No virtual environment found; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment
2024-10-02 17:24:42.998 ERROR (MainThread) [homeassistant.setup] Setup failed for 'cloud': Requirements for conversation not found: ['home-assistant-intents==2024.10.2'].
2024-10-02 17:24:42.998 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of 'recovery_mode'. Setup failed for dependencies: ['frontend', 'cloud']
2024-10-02 17:24:42.999 ERROR (MainThread) [homeassistant.setup] Setup failed for 'recovery_mode': Could not setup dependencies: frontend, cloud

How do you run HA? Please provide all the information, which is requested in the issue description, too. Otherwise it's hard to help you

terminet85 commented 1 week ago

Beware in my case isn't enough to pass only the bin PATH, I also need to create a environment with executing 'uv venv' in shell.

@billyburly Same error logs I got, try to create the env.

edenhaus commented 1 week ago

Running home assistant with systemd is a not supported installation type, and therefore, we will not give support for it.

@terminet85 You did not provide how you are running HA, but all installation types we offered on www.home-assistant.io either use the container provided by us or you need to create a venv. So I'm expecting you are also using a not supported installation type

terminet85 commented 1 week ago

@edenhaus sorry I tagged you wrongly. Yes, I'm using a unsupported installation.

00svd00 commented 1 week ago

If you use systemd, add the path to the environment.

Worked for me. You can also add this to systmd to move log files to /var/log (where they should be)

ExecStartPre=+/usr/bin/install -g homeassistant -o homeassistant -d %L/homeassistant
ExecStartPre=/bin/bash -c 'if [ ! -L ./home-assistant.log ]; then  rm ./home-assistant.log; ln -s %L/homeassistant/home-assistant.log; fi'
ExecStartPre=/bin/bash -c 'if [ ! -L ./home-assistant.log.1 ]; then rm ./home-assistant.log.1; ln -s %L/homeassistant/home-assistant.log.1; fi'
ExecStartPre=/bin/bash -c 'if [ ! -L ./home-assistant.log.fault ]; then rm ./home-assistant.log.fault; ln -s %L/homeassistant/home-assistant.log.fault; fi'
ExecStart=/opt/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant" --log-file=%L/homeassistant/home-assistant.log --log-rotate-days 5

Full text:

[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=homeassistant
WorkingDirectory=/home/homeassistant/.homeassistant
ExecStartPre=+/usr/bin/install -g homeassistant -o homeassistant -d %L/homeassistant
ExecStartPre=/bin/bash -c 'if [ ! -L ./home-assistant.log ]; then  rm ./home-assistant.log; ln -s %L/homeassistant/home-assistant.log; fi'
ExecStartPre=/bin/bash -c 'if [ ! -L ./home-assistant.log.1 ]; then rm ./home-assistant.log.1; ln -s %L/homeassistant/home-assistant.log.1; fi'
ExecStartPre=/bin/bash -c 'if [ ! -L ./home-assistant.log.fault ]; then rm ./home-assistant.log.fault; ln -s %L/homeassistant/home-assistant.log.fault; fi'
ExecStart=/opt/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant" --log-file=%L/homeassistant/home-assistant.log --log-rotate-days 5
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/homeassistant/bin:/home/homeassistant/.local/bin"
RestartForceExitStatus=100
Restart=on-failure

[Install]
WantedBy=multi-user.target
smiths78 commented 1 week ago

Adding the path to the environment worked for me too, thanks.

doctorlunch commented 1 week ago

Same problem for me. I upgraded to 2024.10.0 and it now keeps rebooting at random or not responding. Rolling back to previous version.

evilphish commented 1 week ago

If you are running HA from a pyenv you can actually get around creating another uv venv (because having a venv inside a venc is a bit silly and redundant) by including Environment="UV_SYSTEM_PYTHON=1" in your systemd service file.

pw44 commented 1 week ago

Uv will be installed automatically during the installation of the home assistant. The user needs to make sure that the venv is activated or the PATH variable includes binaries installed wth python pip

how to install Uv manually, please?

kbrown01 commented 1 week ago

Same issue. While I understand people with Core only on Python virtual are """""not supported""""", none of this helps someone not a Python expert. Whole installation hosed, many things do not load, TVs are useless now, my gate is out of commission (broadliink) and many other things. Not to mention all my PADs in the home and all remote access ceases to work.

Us poor "unsupported" people who do not understand the above descriptions and what to do are in trouble and probably leaving.

Downgraded to 2024.9.2 ... back to working. Set up a separate "test" installation and all is broken on it. So I will continue this way I guess, no way to upgrade without clear instructions on why "uv" directory is missing.

fabricioavil commented 1 week ago

Same issue. While I understand people with Core only on Python virtual are """""not supported""""", none of this helps someone not a Python expert. Whole installation hosed, many things do not load, TVs are useless now, my gate is out of commission (broadliink) and many other things. Not to mention all my PADs in the home and all remote access ceases to work.

Us poor "unsupported" people who do not understand the above descriptions and what to do are in trouble and probably leaving.

Downgraded to 2024.9.2 ... back to working. Set up a separate "test" installation and all is broken on it. So I will continue this way I guess, no way to upgrade without clear instructions on why "uv" directory is missing.

the fix is in: https://community.home-assistant.io/t/2024-10-heading-in-the-right-direction/777864/35

1) go to your systemd file, mine is: sudo vi /etc/systemd/system/home-assistant@homeassistant.service

2) add the line below under [Service]: Environment="PATH=/srv/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/homeassistant/.local/bin"

3) restart the daemon sudo systemctl daemon-reload

4) restart HASS

pw44 commented 1 week ago

Same issue. While I understand people with Core only on Python virtual are """""not supported""""", none of this helps someone not a Python expert. Whole installation hosed, many things do not load, TVs are useless now, my gate is out of commission (broadliink) and many other things. Not to mention all my PADs in the home and all remote access ceases to work. Us poor "unsupported" people who do not understand the above descriptions and what to do are in trouble and probably leaving. Downgraded to 2024.9.2 ... back to working. Set up a separate "test" installation and all is broken on it. So I will continue this way I guess, no way to upgrade without clear instructions on why "uv" directory is missing.

the fix is in: https://community.home-assistant.io/t/2024-10-heading-in-the-right-direction/777864/35

  1. go to your systemd file, mine is: sudo vi /etc/systemd/system/home-assistant@homeassistant.service
  2. add the line below under [Service]: Environment="PATH=/srv/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/homeassistant/.local/bin"
  3. restart the daemon sudo systemctl daemon-reload
  4. restart HASS

does not works. downgraded to 2024.10.0 and it works.

But i have UV installed: /var/homeassistant/bin/uv and have the Environment="PATH=/var/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" line in the systemctl file.

So, we, "non supported" core installations folks would gladly know how to make it work....

prairiesnpr commented 1 week ago

does not works. downgraded to 2024.10.0 and it works.

But i have UV installed: /var/homeassistant/bin/uv and have the Environment="PATH=/var/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" line in the systemctl file.

So, we, "non supported" core installations folks would gladly know how to make it work....

Without logs, no one here is going to be able to help. We don't even know if you have the same issue as OP. If 2024.10.0 is working for you, then you probably don't have the same issue, since uv was used for deferred integrations starting in 2024.10.0.

pw44 commented 1 week ago

does not works. downgraded to 2024.10.0 and it works. But i have UV installed: /var/homeassistant/bin/uv and have the Environment="PATH=/var/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" line in the systemctl file. So, we, "non supported" core installations folks would gladly know how to make it work....

Without logs, no one here is going to be able to help. We don't even know if you have the same issue as OP. If 2024.10.0 is working for you, then you probably don't have the same issue, since uv was used for deferred integrations starting in 2024.10.0.

So, log says:

File "/var/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 103, in _install_with_retry if pkg_util.install_package(requirement, **kwargs): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/homeassistant/lib/python3.12/site-packages/homeassistant/util/package.py", line 140, in install_package with Popen( ^^^^^^ File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'uv'

if uv is present at /var/homeasssistant/bin/uv, how does i not works?

pw44 commented 1 week ago

does not works. downgraded to 2024.10.0 and it works. But i have UV installed: /var/homeassistant/bin/uv and have the Environment="PATH=/var/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" line in the systemctl file. So, we, "non supported" core installations folks would gladly know how to make it work....

Without logs, no one here is going to be able to help. We don't even know if you have the same issue as OP. If 2024.10.0 is working for you, then you probably don't have the same issue, since uv was used for deferred integrations starting in 2024.10.0.

So, log says:

File "/var/homeassistant/lib/python3.12/site-packages/homeassistant/requirements.py", line 103, in _install_with_retry if pkg_util.install_package(requirement, **kwargs): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/var/homeassistant/lib/python3.12/site-packages/homeassistant/util/package.py", line 140, in install_package with Popen( ^^^^^^ File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'uv'

if uv is present at /var/homeasssistant/bin/uv, how does i not works?

i downgraded to have it working.

prairiesnpr commented 1 week ago

Because you didn't set the path as outlined above. The environment variable for path includes /var/homeassistant/bin if you activate the venv directly, but it doesn't if you run Hass via systemd. If you can run uv from the venv, but HA fails with the logs you posted, add the path and retest.

pw44 commented 1 week ago

Because you didn't set the path as outlined above. The environment variable for path includes /var/homeassistant/bin if you activate the venv directly, but it doesn't if you run Hass via systemd. If you can run uv from the venv, but HA fails with the logs you posted, add the path and retest.

my systemd file:

`[Unit] Description=Home Assistant After=network-online.target

[Service] Type=simple User=homeassistant WorkingDirectory=/var/homeassistant/.homeassistant ExecStart=/var/homeassistant/bin/hass -c "/var/homeassistant/.homeassistant" Environment="PATH=/var/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

[Install] WantedBy=multi-user.target `

so, i have Environment="PATH=/var/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" line in the systemctl file.

add the path and retest. - could you please explain where, as i'm not getting it?

Geekette commented 1 week ago

Hello HASS community!

Whilst adding a PATH is the systemd file seems to solve most issues, we found out in #127621 that this does not prevent some version mismatch that could end up blocking in the future.

For contexte, the XIAOMI-BLE was not updated from 0.30.2 to 0.32.0 during the upgrade, even after:

  1. rollback to 2024.9.3
  2. specifying a PATH in systemd
  3. updating to 2024.10.1

I found out a quick fix that requires to upgrade manually the integration via pip: pip install --upgrade extensionName

Still this might be the beginning of big issues if releases come up with lot of integration update. If anyone is still having issues with extensions AFTER specifying a PATH, maybe consider reviewing the installed version of the integration (pip list will let you know) and then trying to update it with the command listed before.

Edit : I reviewed my pip list versus the requirements_all.txt for 2024.10.1. As suspected, other updates failed silently. For instance, zeroconf is expected to be 0.135.0. pip list reports 0.133.0. Manual upgrade via pip works.

00svd00 commented 1 week ago

so, i have Environment="PATH=/var/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" line in the systemctl file.

add the path and retest. - could you please explain where, as i'm not getting it?

At first you should check if theese envs are present for your hass process cat /proc/$(pidof -x hass)/environ | tr $"\0" $"\n" you should see something like this:

LANG=ru_RU.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/homeassistant/bin:/home/homeassistant/.local/bin
HOME=/home/homeassistant
LOGNAME=homeassistant
USER=homeassistant
SHELL=/bin/sh
INVOCATION_ID=ab254415dad94b27a1914bd05b62e610
JOURNAL_STREAM=8:1737410
SYSTEMD_EXEC_PID=92548
UV_SYSTEM_PYTHON=1
hafnerra commented 1 week ago

Hello HASS community!

Whilst adding a PATH is the systemd file seems to solve most issues, we found out in #127621 that this does not prevent some version mismatch that could end up blocking in the future.

For contexte, the XIAOMI-BLE was not updated from 0.30.2 to 0.32.0 during the upgrade, even after:

  1. rollback to 2024.9.3
  2. specifying a PATH in systemd
  3. updating to 2024.10.1

I found out a quick fix that requires to upgrade manually the integration via pip: pip install --upgrade extensionName

Still this might be the beginning of big issues if releases come up with lot of integration update. If anyone is still having issues with extensions AFTER specifying a PATH, maybe consider reviewing the installed version of the integration (pip list will let you know) and then trying to update it with the command listed before.

Edit : I reviewed my pip list versus the requirements_all.txt for 2024.10.1. As suspected, other updates failed silently. For instance, zeroconf is expected to be 0.135.0. pip list reports 0.133.0. Manual upgrade via pip works.

I can't understand your experience. I have updated from version 2024.9.3 to 2024.10.0 without the PATH variable. Only after the frontend stopped working did I add the PATH variable in the systemd file. I just checked if zeroconf has the version 0.135.

pw44 commented 1 week ago

so, i have Environment="PATH=/var/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" line in the systemctl file.

add the path and retest. - could you please explain where, as i'm not getting it?

At first you should check if theese envs are present for your hass process cat /proc/$(pidof -x hass)/environ | tr $"\0" $"\n" you should see something like this:

LANG=ru_RU.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/homeassistant/bin:/home/homeassistant/.local/bin
HOME=/home/homeassistant
LOGNAME=homeassistant
USER=homeassistant
SHELL=/bin/sh
INVOCATION_ID=ab254415dad94b27a1914bd05b62e610
JOURNAL_STREAM=8:1737410
SYSTEMD_EXEC_PID=92548
UV_SYSTEM_PYTHON=1

under which user? su to homeassistant user - sudo -u homeassistant -H -s ?

00svd00 commented 1 week ago

so, i have Environment="PATH=/var/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" line in the systemctl file.

add the path and retest. - could you please explain where, as i'm not getting it?

At first you should check if theese envs are present for your hass process cat /proc/$(pidof -x hass)/environ | tr $"\0" $"\n" you should see something like this:

LANG=ru_RU.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/homeassistant/bin:/home/homeassistant/.local/bin
HOME=/home/homeassistant
LOGNAME=homeassistant
USER=homeassistant
SHELL=/bin/sh
INVOCATION_ID=ab254415dad94b27a1914bd05b62e610
JOURNAL_STREAM=8:1737410
SYSTEMD_EXEC_PID=92548
UV_SYSTEM_PYTHON=1

under which user? su to homeassistant user - sudo -u homeassistant -H -s ?

Doesn't matter. You will see envs of existing process

vervoto1 commented 1 week ago

Hello HASS community!

Whilst adding a PATH is the systemd file seems to solve most issues, we found out in #127621 that this does not prevent some version mismatch that could end up blocking in the future.

For contexte, the XIAOMI-BLE was not updated from 0.30.2 to 0.32.0 during the upgrade, even after:

  1. rollback to 2024.9.3
  2. specifying a PATH in systemd
  3. updating to 2024.10.1

I found out a quick fix that requires to upgrade manually the integration via pip: pip install --upgrade extensionName

Still this might be the beginning of big issues if releases come up with lot of integration update. If anyone is still having issues with extensions AFTER specifying a PATH, maybe consider reviewing the installed version of the integration (pip list will let you know) and then trying to update it with the command listed before.

Edit : I reviewed my pip list versus the requirements_all.txt for 2024.10.1. As suspected, other updates failed silently. For instance, zeroconf is expected to be 0.135.0. pip list reports 0.133.0. Manual upgrade via pip works.

Thanks, this resolved the XIAOMI-BLE issue for me (manually upgrading via PIP).

Bluesound integration also stopped working in 24.10.1 and your theory was correct there as well, upgraded Blupy via PIP and voila, issue solved. Pyblu updated from v 0.4 to 1.0.3 which suggests that it hasn't been touched for a while / wasn't automatically updated with home assistant.

Geekette commented 1 week ago

Bluesound integration also stopped working in 24.10.1 and your theory was correct there as well, upgraded Blupy via PIP and voila, issue solved. Pyblu updated from v 0.4 to 1.0.3 which suggests that it hasn't been touched for a while / wasn't automatically updated with home assistant.

After looking back at a backup of my installation I'm starting to wonder : could it be uv using wrong Python version? Hence downloading the latest version of the integration compatible with that unexpected Python? In your hass venv, what's the return value of python --version (I have Debian Bookworm default 3.11.2)? How about python3 --version (I have my own install of 3.12.6)? Since python3 is used during venv creation, I did not bother changing the system default "python" path. When hass moved to requiring 3.12 I updated the venv once again via python3. uv using 3.11 from python might be the root cause of the issue.

Edit : Trying to install homeassistant using uv in that venv downloads 2024.3.3, or the latest release compatible with Python 3.11! We're on something I guess. I'll consider a feedback on the documentation for core to perform install and update from uv if your experience is similar to mine.

parautenbach commented 1 week ago

Since python3 is used during venv creation, I did not bother changing the system default "python" path.

If the venv is activated, python will point to the venv's bin/python, which in turn should point to the specific Python version.

(homeassistant) homeassistant@homeassistant:/srv/homeassistant$ which python
/srv/homeassistant/bin/python
(homeassistant) homeassistant@homeassistant:/srv/homeassistant$ ls -l /srv/homeassistant/bin/python
lrwxrwxrwx 1 homeassistant homeassistant 10 Feb 22  2024 /srv/homeassistant/bin/python -> python3.12
slyoldfox commented 1 week ago

Same issue here with a HomeAssistant core installation, pip3.12 install uv said it was already installed within the venv - had to put the path as shown in the systemd config.

west17m commented 1 week ago

Same issue on Gentoo but with openrc and homeassistant installed via venv. Following the thread

(venv)  hass --version
2024.10.1

(venv) uv --version
uv 0.4.15
madkevo commented 1 week ago

Hi all, I had similar issues and I discovered that I had been reusing the same virtual environment every time I was upgrading HA Core. Lack of understanding, today was a school day. It was fine until 2024.9.3 but 2024.10.0 onwards proved too much for it, with the main issue being the python version used to create the original venv in the first place was 3.8. Each time I was "recreating" the virtual environment using python3.12 into the same directory without clearing the directory out first. So, I deleted /srv/homeassistant in my case, created the venv again there with phyon3.12 as always and bingo, no uv errors or unmet dependences from aiohttp etc. I'm using a systemd file with the environment variables set correctly. Hope this helps.

parautenbach commented 1 week ago

Each time I was "recreating" the virtual environment using python3.12 into the same directory without clearing the directory out first.

Yes, you should definitely do this every time you change Python versions. This is not specific to HA, but a general best practice. In fact, don't clear out the directory – completely remove the parent to ensure you also remove any hidden files and directories. As always, backup your instance.

So, I deleted /srv/homeassistant in my case, created the venv again there with phyon3.12 as always and bingo, no uv errors or unmet dependences from aiohttp etc.

Interesting. In my case, there was no Python change, as I've already been running Python 3.12 for a while. It would be good to know if others experienced the same. Maybe I'll try this out too.

west17m commented 1 week ago

Each time I was "recreating" the virtual environment using python3.12 into the same directory without clearing the directory out first.

Yes, you should definitely do this every time you change Python versions. This is not specific to HA, but a general best practice. In fact, don't clear out the directory – completely remove the parent to ensure you also remove any hidden files and directories. As always, backup your instance.

I upgrade my Python version in my venv before updating HA with python -m venv --upgrade /opt/homeassistant/hass.env

Currently, I'm on 3.12 but I started probably around 3.8 or 3.9.

(venv) python --version
Python 3.12.6

This should be a reasonable workflow as well - and less destructive.

Chupaka commented 6 days ago

I upgrade my Python version in my venv before updating HA with python -m venv --upgrade

For me, this was not updating python* symlinks, so python3 was still pointing to python3.10 instead of python3.12. I had to manually update the symlink, after that it started to work.

f45tb00t commented 6 days ago

I absolutely appreciate your hard work on HomeAssistant. But in fact to break something in this way is kinda ridiculous. Especially without further notice.

So for my Setup OS: Debian 12 Python 3.12: self compiled (as usually Debian python version runs out of what HA expects. So I had to compile it!)

I fixed now the PATH, but in fact then HA is complaining about Python 3.9.x, which was not used for the venv.

So actually I really would like to understand what you have changed and why. Especially since my setup worked now for years without any issues. HA expected a new python, i compiled it, created a new venv, installed HA again and everything worked as expected. Then you changed something and now the issues start. I can fix issue by issue, and even with 10.1 it got even worse. Ping is not coming up, ESPhome does not load, ibeacon does not load and many other issues.

Also starting a service via systemd is nowadays absolutely common. This is not rocket science and expected behavior on a systemd installation!

Some help from your side would be highly appreciated!

parautenbach commented 6 days ago

Chill. What gives you the impression this was deliberate or even a known issue?

This is not the place to attack or rant. Provide additional technical information if you have any.

Currently, this looks to be more of a problem with how virtual environments are managed by Python tooling.

f45tb00t commented 6 days ago

@parautenbach I do chill. I don't attack anyone nor I am about to rant. What I just don't like is the the attitude, that something is not supported. I mean for real, systemd is nowadays standard. And it's really not rocket science to configure a service with it. Especially since this ran for all of us for years without any issues.

So of course I am interested what have been changed to cause this.

For me it seems I fixed mostly of it. Or well... lets see till the next update.

Steps:

1-3. cover correct compile options. not needed here...

4. move old installation to create new
sudo mv /srv/homeassistant /srv/homeassistant_old_python3.12

5. create folders and grant permissions to HA user
sudo mkdir /srv/homeassistant
sudo chown homeassistant:homeassistant /srv/homeassistant

6. edit .bashrc of homeassistant user. point to compiled python version
export PATH=$PATH:/usr/local/opt/python-3.12.6/bin

7. change to correct user, create venv, install HA
sudo -u homeassistant -H -s
cd /srv/homeassistant
python3.12 -m venv .
source bin/activate
python3.12 -m pip install wheel
pip install homeassistant
// fix missing dependencies e.g 
pip install psycopg2
pip install psutil-home-assistant

8. change systemd service (I had to try diffrent Environment varibales, as it was mixing the python versions!)
[Unit]
Description=Home Assistant
After=network-online.target
[Service]
Type=simple
User=%i
WorkingDirectory=/home/%i/.homeassistant
TimeoutStartSec=infinity
ExecStartPre=/bin/sleep 10
### path to ha venv must fit to fix uv issue, path to python must fit, path to ping and other tools must fit!. This was NOT needed before 2024.10.*
Environment="PATH=/srv/homeassistant/bin:/usr/local/opt/python-3.12.2/bin:/usr/bin"
ExecStart=/srv/homeassistant/bin/hass -c "/home/%i/.homeassistant"
Restart=on-failure
RestartSec=120s
After=network.target postgresql.service

8. reload 
sudo systemctl daemon-reload
sudo service home-assistant@homeassistant stop && sudo service home-assistant@homeassistant start && tail -f /home/homeassistant/.homeassistant/home-assistant.log

Notes: I have several python versions installed (system wise and self compiled). If the PATH was not correctly declared, then sometimes it tried to use a completely wrong one, which resulted in issues. For instance integration home connect was not possible to install. Saw in the logs it tried to use python 3.9.7

parautenbach commented 6 days ago

So of course I am interested what have been changed to cause this.

I agree that this should be the focus for now. I'd like to avoid it, since it was quite a surprise.

milkywade commented 2 days ago

If you use systemd, add the path to the environment.

Eventually, this worked for me. It was unclear to me which PATH to add, but it was sufficient to add the /path/to/env/bin folder in my case (where env is a virtual environment).

...
Environment="PATH=/opt/apps/homeassistant/env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
...

Updating the systemd file as per this post worked for me, indeed you MUST mention the python virtual env folder used to run HA:

  1. my systemd file is located here: /etc/systemd/system/home-assistant.service
  2. the environment line I added is this one:

Environment="PATH=/srv/homeassistant/venv_3.12.2/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/homeassistant/.local/bin"

where /srv/homeassistant/venv_3.12.2/bin/ is the path to my python virtual environment

  1. stop home assistant
  2. I did do launch this command, just to be sure sudo systemctl daemon-reload
  3. restart HA
andbad commented 1 day ago

so, i have Environment="PATH=/var/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" line in the systemctl file.

add the path and retest. - could you please explain where, as i'm not getting it?

At first you should check if theese envs are present for your hass process cat /proc/$(pidof -x hass)/environ | tr $"\0" $"\n" you should see something like this:

LANG=ru_RU.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/homeassistant/bin:/home/homeassistant/.local/bin
HOME=/home/homeassistant
LOGNAME=homeassistant
USER=homeassistant
SHELL=/bin/sh
INVOCATION_ID=ab254415dad94b27a1914bd05b62e610
JOURNAL_STREAM=8:1737410
SYSTEMD_EXEC_PID=92548
UV_SYSTEM_PYTHON=1

Thank you, I solved with yo

Same issue. While I understand people with Core only on Python virtual are """""not supported""""", none of this helps someone not a Python expert. Whole installation hosed, many things do not load, TVs are useless now, my gate is out of commission (broadliink) and many other things. Not to mention all my PADs in the home and all remote access ceases to work. Us poor "unsupported" people who do not understand the above descriptions and what to do are in trouble and probably leaving. Downgraded to 2024.9.2 ... back to working. Set up a separate "test" installation and all is broken on it. So I will continue this way I guess, no way to upgrade without clear instructions on why "uv" directory is missing.

the fix is in: https://community.home-assistant.io/t/2024-10-heading-in-the-right-direction/777864/35

  1. go to your systemd file, mine is: sudo vi /etc/systemd/system/home-assistant@homeassistant.service
  2. add the line below under [Service]: Environment="PATH=/srv/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/homeassistant/.local/bin"
  3. restart the daemon sudo systemctl daemon-reload
  4. restart HASS

Thank you very much. I just had to change the "/home/homeassistant/.local/bin" to match the actual correct dir (I found it in "ExecStart" row).

By(t)e