The latest version of Home Assistant Core requires python 3.10.
Raspberry Pi OS (Debian) ships python 3.9.
Here’s what I did:
I installed python 3.10.9 from source, using the
altinstallmethod to keep python 3.9 too. I’ve no particular recommendation for instructions; these seem fine.
I stopped my existing Home Assistant service. For me, that was
sudo systemctl stop hass@homeassistantas I have a systemd job for it.
I moved my existing installation directory
/srv/homeassistant_python3.9as a backup, just in case. (Note that this does not touch your config directory, which is a hidden
.homeassistantdirectory under your homeassistant user’s home directory, if you use the normal Home Assistant core installation instructions. This means that, when you restart your newly-installed Home Assistant at the end of the process here, it should be exactly the same as before.)
I did the normal Home Assistant Core installation, except that, rather than running
python3 -m venv ., I ran
python3.10 -m venv .to force it to use the newly-installed python3.10.
I restarted Home Assistant:
sudo systemctl start hass@homeassistant
I waited a few minutes, and Home Assistant restarted.