Python 3.8 backport for Debian buster
With the release of Home Assistant 0.116, Python 3.7 is now deprecated and support will be removed in 0.118. This is not a problem for people running Home Assistant OS, or using the official Docker container. However many of us who are running Debian-based operating systems (including Raspberry Pi OS) can’t install Python 3.8 or later from the official repositories. Support will only come with Debian bullseye which will not be released before at least April 2021.
If you are not willing to use the Docker container, the only option you have left is compiling Python from source yourself. Although this works usually pretty good, by compiling from source and installing it, you are effectively bypassing any form of version and dependency control you have with package managers like APT. It is also usually not as easy to remove after you have installed it. Of course compiling also takes a bit of time.
To make your life easier (and keep my homeserver as clean as possible), I made a backport of Python 3.8 for Debian buster (using Debian bullseye) which you can simply install via APT. If there will be any updates to Python 3.8 before Debian bullseye is released, these will simply be distributed via APT as well.
Scope
The scope of this project is limited to backporting just Python 3.8 itself. So no defaults (which provide virtual packages so python3
get’s automatically linked to python3.8
for example), no pip and no pip-packages. This version should be an extension to your system, but it’s not meant to replace an existing Python installation.
Virtual enviroment
To make the venv
module work without backporting all pip-related packages, the python3.8-venv
package depends on python3-distutils
which is present in buster. After you have created your virtual enviroment you can then update pip itself (if you so desire, but optional) and any packages as usual.
Repository
NOTE: You should never install keys and add repositories from developers you don’t trust. Decide for yourself if I’m trustworthy and if you have any doubts, check out the source and compile the packages yourself.
You can download the packages in my repository at deb.pascalroeleven.nl
.
You should add my PGP (which you can get from my website via https) to APT’s sources keyring before you can download from the repository:
wget https://pascalroeleven.nl/deb-pascalroeleven.gpg
sudo apt-key add deb-pascalroeleven.gpg
Afterwards you should add this line to your sources.list
(/etc/apt/sources.list
):
deb http://deb.pascalroeleven.nl/python3.8 buster-backports main
You can now update your package index:
sudo apt update
and install Python 3.8 related packages:
sudo apt install python3.8 python3.8-venv python3.8-dev
You can then recreate your venv as mentioned here. Just be sure to specify python3.8
explicitly instead of python3
. Once your inside your venv, python
and python3
will be linked to python3.8
. Please note that upgrading your current venv does not work without hassle because of the lack of python3-defaults
and the need to recompile modules for a lot of packages.
Support
Currently there is support for amd64
, arm64
and armhf
architectures. The amd64
packages are build natively while the arm64
and armhf
packages are crossbuilt. Testing is not possible while crossbuilding, so these packages did not undergo the same amount of testing as usual Debian packages do.
These are the only architectures I am able to test. However if there is a demand, I can try cross compiling for different architectures as well and distribute those.
The Raspberry Pi 1 is not supported as it uses a different processor architecture than what Debian builds for.
If you want to check out the source, you can visit the Github.
I hope this will help some people out.