To install 3.9:
Python 3.9 is not available by default in Ubuntu repos so:
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
#Check 3.9 available
sudo apt list | grep python3.9
sudo apt-get install python3.9
#Add 3.9 to the versions of Python available. Ubuntu will try to use 3.6/7 by default
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2
#Now configure system to use 3.9 as default.
sudo update-alternatives --config python3
To confirm 3.9 being used:
Here are the steps I used for the upgrade to 3.7 many moons ago. Not tried it yet and will try to update to 3.9 later next week, but feel free to give it a go. I have amended it for 3.9
systemctl stop [email protected]
apt install python3.9
apt install python3.9-dev
apt install python3.9-venv
mv homeassistant homeassistant_old
chown homeassistant:homeassistant homeassistant
sudo -u homeassistant -H -s
python3.9 -m venv .
pip install --upgrade pip
python3.9 -m pip install mysqlclient
python3.9 -m pip install homeassistant
pip install home-assistant-frontend
systemctl start [email protected]
journalctl -f -u [email protected]
Running in Ubuntu 18.04 LTS and I use an external MySQL database.
As I say none of this is tested yet, but I can’t see why it won’t work.
EDIT: just saw you are using RPI OS - this should work on that too - I will check on one of my PIs later.
EDIT2: Just ran all the above against my Ubuntu Core install and all is good. The only issue I had was that in my service file I had pointed to a different path (when I upgraded from python3.6 → 3.7) rather than /srv/homeassistant - once I corrected that all was good in the hood