Upgrading HomeAssistant Core in a Python VE

Hello,

I was on Ubuntu 24.04 LTS with Python 3.12, using Home Assistant 2024.11.

As Home Assistant 2024.12 now supports Python 3.13 and 2025.2 will require it, which doesn’t natively ship with Ubuntu 24.04, I upgraded using the following steps.

The key ideas were:

  • Use uv for installing Python 3.13, because uv can install it in a way that doesn’t interfere with the system’s Python at all.
  • Keep the upgrade steps close to the official installation docs (Linux - Home Assistant).
sudo systemctl stop home-assistant@homeassistant

cd /srv
sudo mv homeassistant homeassistant-old-3.12
sudo mkdir homeassistant
sudo chown homeassistant:homeassistant homeassistant

# Now work as user `homeassistant`.
sudo -u homeassistant -H -s

# If `uv` is not yet installed:
cd ~
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env

# Install Python 3.13:
uv python install 3.13

# Create the virtual environment and install `homeassistant`:
cd /srv/homeassistant
uv venv . --python 3.13
source bin/activate
uv pip install homeassistant==2024.12.5

# It takes a while before your HA system becomes available in the browser.
# Check for log output, test your system in the browser, then quit with CTRL+C.
hass
exit

sudo systemctl start home-assistant@homeassistant

This worked very well for me, but note that my Home Assistant install doesn’t include any custom Python packages or other non-standard extras.

2 Likes