Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024.10.0 HA core doesn't find uv #127359

Open
00svd00 opened this issue Oct 2, 2024 · 58 comments
Open

2024.10.0 HA core doesn't find uv #127359

00svd00 opened this issue Oct 2, 2024 · 58 comments

Comments

@00svd00
Copy link

00svd00 commented Oct 2, 2024

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
Copy link

hafnerra commented Oct 2, 2024

Same Problem here

@centertivevier
Copy link
Contributor

centertivevier commented Oct 2, 2024

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
Copy link

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
Copy link

zanezam commented Oct 2, 2024

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
Copy link

hafnerra commented Oct 2, 2024

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
Copy link

zanezam commented Oct 2, 2024

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
Copy link
Contributor

Thanks. The frontend start.

@billyburly
Copy link
Contributor

billyburly commented Oct 2, 2024

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
Copy link

basilfx commented Oct 2, 2024

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
Copy link

svenf01 commented Oct 3, 2024

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
Copy link
Contributor

edenhaus commented Oct 3, 2024

@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 edenhaus changed the title After upgrade to 2024.10.0 HA doesn't start 2024.10.0 HA core doesn't find uv Oct 3, 2024
@edenhaus
Copy link
Contributor

edenhaus commented Oct 3, 2024

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
Copy link
Contributor

edenhaus commented Oct 3, 2024

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
Copy link
Contributor

terminet85 commented Oct 3, 2024

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
Copy link
Contributor

edenhaus commented Oct 3, 2024

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
Copy link
Contributor

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

@00svd00
Copy link
Author

00svd00 commented Oct 3, 2024

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
Copy link

smiths78 commented Oct 3, 2024

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

@doctorlunch
Copy link

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
Copy link

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
Copy link

pw44 commented Oct 3, 2024

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
Copy link

kbrown01 commented Oct 4, 2024

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
Copy link

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
Copy link

pw44 commented Oct 5, 2024

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
Copy link

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
Copy link

pw44 commented Oct 6, 2024

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?

@Geekette
Copy link

Geekette commented Oct 6, 2024

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
Copy link
Author

00svd00 commented Oct 6, 2024

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
Copy link

hafnerra commented Oct 6, 2024

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
Copy link

pw44 commented Oct 6, 2024

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
Copy link
Author

00svd00 commented Oct 7, 2024

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
Copy link

vervoto1 commented Oct 7, 2024

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
Copy link

Geekette commented Oct 7, 2024

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
Copy link

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
Copy link
Contributor

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
Copy link

west17m commented Oct 8, 2024

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
Copy link

madkevo commented Oct 8, 2024

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
Copy link

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
Copy link

west17m commented Oct 8, 2024

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
Copy link
Contributor

Chupaka commented Oct 8, 2024

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
Copy link

f45tb00t commented Oct 9, 2024

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
Copy link

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
Copy link

f45tb00t commented Oct 9, 2024

@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
Copy link

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
Copy link

milkywade commented Oct 13, 2024

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
Copy link

andbad commented Oct 14, 2024

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

@julesxxl
Copy link

julesxxl commented Oct 20, 2024

For those who are on MacOS with HA Core and have problems with uv “not found” : I had a ~/Library/LaunchAgents/org.homeassistant.plist.
I placed “/opt/homebrew/bin:” at the beginning of EnvironmentVariables node in the string part (where are the paths).

@pw44
Copy link

pw44 commented Oct 20, 2024

Hya,

i did try to update today, and have the following /etc/systemd/system/home-assistant.service:

`[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"
Environment="UV_SYSTEM_PYTHON=1"

[Install]
WantedBy=multi-user.target`

by cat /proc/$(pidof -x hass)/environ | tr $"\0" $"\n" i get:

LANG=en_US.UTF-8 PATH=/var/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin _WSREP_START_POSITION= USER=homeassistant LOGNAME=homeassistant HOME=/var/homeassistant INVOCATION_ID=de5f77d9051a421284feae3fbf4b6efb JOURNAL_STREAM=8:56521 SYSTEMD_EXEC_PID=10546 MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/system.slice/home-assistant.service/memory.pressure MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA= UV_SYSTEM_PYTHON=1

and get the following errors;

`2024-10-20 11:01:32.317 INFO (SyncWorker_4) [homeassistant.util.package] Attempting install of aioesphomeapi==27.0.0
2024-10-20 11:01:32.623 ERROR (SyncWorker_4) [homeassistant.util.package] Unable to install package aioesphomeapi==27.0.0: error: The interpreter at /usr is externally managed, and indicates the following:

To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

Consider creating a virtual environment with uv venv.
2024-10-20 11:01:32.624 ERROR (MainThread) [homeassistant.setup] Setup failed for 'bluetooth_adapters': Requirements for esphome not found: ['aioesphomeapi==27.0.0'].
2024-10-20 11:01:32.624 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of 'ibeacon'. Setup failed for dependencies: ['bluetooth_adapters']
2024-10-20 11:01:32.624 ERROR (MainThread) [homeassistant.setup] Setup failed for 'ibeacon': Could not setup dependencies: bluetooth_adapters
2024-10-20 11:01:37.427 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up upnp.binary_sensor
2024-10-20 11:01:37.427 INFO (MainThread) [homeassistant.components.sensor] Setting up upnp.sensor
2024-10-20 11:01:37.431 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 15.51s
2024-10-20 11:01:37.431 WARNING (MainThread) [homeassistant.bootstrap] Detected that frontend did not load. Activating recovery mode
2024-10-20 11:01:38.135 ERROR (SyncWorker_9) [homeassistant.util.package] 2024-10-20 11:01:38.135 ERROR (SyncWorker_9) [homeassistant.util.package] Unable to install package home-assistant-frontend==20241002.3: error: The interpreter at /usr is externally managed, and indicates the following:

To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

Consider creating a virtual environment with uv venv.`

Advises, please?

@hjf
Copy link

hjf commented Oct 20, 2024

In my case, I'm using FreeBSD. What I needed to do was source the venv created by uv. I had been using the installation guide from here, but it stopped working after 2024.10. These are the steps to upgrade this setup.

  1. Become homeassistant: su homeassistant
  2. cd home: cd
  3. Create a new venv: uv venv hap312 --python 3.12
  4. Activate it: . /home/homeassistant/hap312-202410/bin/activate
  5. Install HA: uv pip install homeassistant
  6. Go back to being root: Ctrl-D
  7. Edit your rc.conf, and set: homeassistant_venv=/home/homeassistant/hap312
  8. This is the important bit and I don't know why!!: Edit your rc.script for homeassistant (/usr/local/etc/rc.d/homeassistant) and activate the venv in it too. Look for the line . /etc/rc.subr and add . /home/homeassistant/hap312-202410/bin/activate below it.
  9. Start HA /usr/local/etc/rc.d/homeassistant start

@estebanz01
Copy link

I upgraded from 2024.09.03 to 2024.10.04 and in order to make it run, I changed my ExecStart from my systemd file to the following:

ExecStart=/bin/bash -c 'PATH=/srv/homeassistant/bin:$PATH exec /srv/homeassistant/bin/hass -c "/home/%i/.homeassistant"'

That way, my PATH variable expands properly as it contains some references to certain binaries in ~/bin that I need there in order to home assistant to see it. If you use zsh or fish or whatever, you can change it to the proper shell command.

Also, I find pretty surprising the HA core installation with systemd is not supported. Maybe it was how the phrase was written, but then how should I run HA core in a way that is supported ? https://www.home-assistant.io/installation/linux#install-home-assistant-core

@hjf
Copy link

hjf commented Oct 25, 2024

Also, I find pretty surprising the HA core installation with systemd is not supported.

Pretty much nothing except the HA OS is supported and you'll get a rather aggressive message every time you ask. Remember: This is no longer an "open source" project but a "product with open source code and a company behind it trying to monetize it".

@hmijail
Copy link

hmijail commented Oct 26, 2024

FWIW, installing home-assistant with pipx used to work great until 2024.9.3. I just updated to 2024.10.4 and found this same problem with uv.
(pipx 1.7.1 using python 3.12.5 on macOS 14.7)

@Steve-2040
Copy link

Steve-2040 commented Oct 26, 2024

My Home Assistant Core setup is on Ubuntu 22.04.5 LTS. After updating from 2024.9.3 to 2024.10.3, I started receiving a lot of errors. It appears that something went wrong with the virtual environment, specifically with the Python symlink files located at /srv/homeassistant/bin that pointed to the wrong location (python -> /usr/bin/python3)

ll /srv/homeassistant/bin/python*
lrwxrwxrwx 1 homeassistant homeassistant       python -> python3.12*
lrwxrwxrwx 1 homeassistant homeassistant       python3 -> python3.12*
lrwxrwxrwx 1 homeassistant homeassistant       python3.12 -> /usr/bin/python3.12*

I updated the symlinks using the following commands:

sudo ln -sf python3.12 /srv/homeassistant/bin/python
sudo ln -sf python3.12 /srv/homeassistant/bin/python3
sudo chown -h homeassistant:homeassistant /srv/homeassistant/bin/python
sudo chown -h homeassistant:homeassistant /srv/homeassistant/bin/python3

After updating the symlinks, the errors stopped.

My original installation was as follows:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.12 python3.12-dev python3.12-venv
sudo apt-get install -y bluez libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff6 libturbojpeg0-dev tzdata ffmpeg liblapack3 liblapack-dev libatlas-base-dev

#setup new user:
sudo useradd -rm homeassistant
sudo chsh -s /bin/bash homeassistant

sudo mkdir /srv/homeassistant
sudo chown homeassistant:homeassistant /srv/homeassistant
sudo -u homeassistant -H -s
cd /srv/homeassistant
python3.12 -m venv .
source bin/activate
python3.12 -m pip install wheel
pip3.12 install homeassistant

My systemd looks like this:

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

[Service]
Type=simple
User=homeassistant
Group=homeassistant
WorkingDirectory=/home/homeassistant/.homeassistant
ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"
Environment="PATH=/srv/homeassistant/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
Restart=always
StandardOutput=journal
StandardError=journal+console

[Install]
WantedBy=multi-user.target

@byte-for-byte
Copy link

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.

For my pyenv setup, I got it working by setting the Service section in hass@ha.service like this:

[Service]
Type=simple
User=ha
Restart=on-failure
RestartSec=5s
WorkingDirectory=/home/ha/.homeassistant
ExecStart=/home/ha/.pyenv/versions/3.12.2/envs/ha-env-3.12.2/bin/hass -c "/home/ha/.homeassistant"
Environment="PATH=/home/ha/.pyenv/versions/3.12.2/envs/ha-env-3.12.2/bin:/usr/bin:/usr/local/bin:/usr/sbin"
Environment="UV_SYSTEM_PYTHON=1"
Environment="UV_PYTHON=/home/ha/.pyenv/versions/3.12.2/envs/ha-env-3.12.2/bin/python"

@maruel
Copy link

maruel commented Nov 12, 2024

If you use the docker image and use homeassistant-docker-venv, you need this commit: tribut/homeassistant-docker-venv@5ffd91e as stated in tribut/homeassistant-docker-venv#38.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests