Home Assistant Core - Python 3.8 backport for Debian buster

Thank you so much for your backport. You are really helping a lot of people out there, which cannot (or do not want to) use Docker. :+1: :+1: :+1:

And it’s also great for people who are developing integrations. Doing that in Docker is just a pain in the ***.

Thanks, this has been really helpful!

Say, can you link this post from the GitHub project’s README.md? I found that long before I found this. Hopefully someone coming here afterwards will find it faster.

Do you think there is something in this topic that is worth mentioning on the GitHub? If anything, the Readme on the GitHub is more up-to-date.

Do you think there is something in this topic that is worth mentioning on the GitHub?

Primarily, it could use the following line:

sudo apt install python3.8 python3.8-venv python3.8-dev

and

You can then recreate your venv as mentioned here .

Those two, mainly – the needed packages, and that installation can proceed as normal afterwards.

When I added the repo via GitHub, I didn’t know there was a python3.8-venv package at all. I assumed I’d need python3.8 and python3.8-dev – but after trying to install setuptools, and with the admonition from GitHub:

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 ) and no pip-packages.

I figured “Ok, binary and absolute minimal python.” I didn’t know what dependencies there were if I were to try to manually install the venv module, but figured possibly setuptools – which didn’t exist as a package, who knows what else that might depend on.

Yes, this was an assumption on my part, but fairly reasonable. I checked the GitHub issues, and none existed (open or closed), so I gave up on that as a personal project that was incomplete. But, since I was searching the same topic in general, I ran across this post, which had the missing info.

Good to know. I added a reference to this topic as an example usage.

The installation of the packages and the creation of the venv is not really related to the backport but more to the use of the backport for Home Assistant. This guide is primarily for people who follow the advanced installation guide but now want to use that in combination with Python 3.8. Besides adding an additional repository and substituting every instance of python3 for python3.8, the guide still holds. In that case you know you need the *-venv package for a virtual environment.

If, however, you knew you needed the package but thought I didn’t provide it and therefore already gave up on the project, I can understand that. I hope I cleared that up on GitHub as well.

Hello. I can’t install python3.8 on my raspberry pi 2 with raspbian.

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
$ sudo apt install python3.8
Lendo listas de pacotes... Pronto
Construindo ĂĄrvore de dependĂȘncias       
Lendo informação de estado... Pronto
The following additional packages will be installed:
  libpython3.8-minimal libpython3.8-stdlib python3.8-minimal
Pacotes sugeridos:
  python3.8-venv python3.8-doc binfmt-support
Os NOVOS pacotes a seguir serĂŁo instalados:
  libpython3.8-minimal libpython3.8-stdlib python3.8 python3.8-minimal
0 pacotes atualizados, 4 pacotes novos instalados, 0 a serem removidos e 0 nĂŁo atualizados.
É preciso baixar 0 B/4.300 kB de arquivos.
Depois desta operação, 17,1 MB adicionais de espaço em disco serão usados.
VocĂȘ quer continuar? [S/n] S
A seleccionar pacote anteriormente nĂŁo seleccionado libpython3.8-minimal:armhf.
(Lendo banco de dados ... 158597 ficheiros e directĂłrios actualmente instalados.)
A preparar para desempacotar .../libpython3.8-minimal_3.8.7-1~bpo10+1_armhf.deb ...
A descompactar libpython3.8-minimal:armhf (3.8.7-1~bpo10+1) ...
A seleccionar pacote anteriormente nĂŁo seleccionado python3.8-minimal.
A preparar para desempacotar .../python3.8-minimal_3.8.7-1~bpo10+1_armhf.deb ...
A descompactar python3.8-minimal (3.8.7-1~bpo10+1) ...
A seleccionar pacote anteriormente nĂŁo seleccionado libpython3.8-stdlib:armhf.
A preparar para desempacotar .../libpython3.8-stdlib_3.8.7-1~bpo10+1_armhf.deb ...
A descompactar libpython3.8-stdlib:armhf (3.8.7-1~bpo10+1) ...
A seleccionar pacote anteriormente nĂŁo seleccionado python3.8.
A preparar para desempacotar .../python3.8_3.8.7-1~bpo10+1_armhf.deb ...
A descompactar python3.8 (3.8.7-1~bpo10+1) ...
Configurando libpython3.8-minimal:armhf (3.8.7-1~bpo10+1) ...
Configurando python3.8-minimal (3.8.7-1~bpo10+1) ...
Illegal instruction
dpkg: erro ao processar o pacote python3.8-minimal (--configure):
 o subprocesso instalado, do pacote python3.8-minimal, o script post-installation retornou erro do status de saĂ­da 132
Configurando libpython3.8-stdlib:armhf (3.8.7-1~bpo10+1) ...
dpkg: problemas com dependĂȘncias impedem a configuração de python3.8:
 python3.8 depende de python3.8-minimal (= 3.8.7-1~bpo10+1); porém:
  Pacote python3.8-minimal nĂŁo estĂĄ configurado ainda.

dpkg: erro ao processar o pacote python3.8 (--configure):
 problemas de dependĂȘncia - deixando desconfigurado
A processar 'triggers' para mime-support (3.62) ...
A processar 'triggers' para gnome-menus (3.31.4-3) ...
A processar 'triggers' para man-db (2.8.5-2) ...
A processar 'triggers' para desktop-file-utils (0.23-4) ...
Erros foram encontrados durante o processamento de:
 python3.8-minimal
 python3.8
E: Sub-process /usr/bin/dpkg returned an error code (1)

Thanks

Are you sure you are using a Raspberry 2? This seems like an architectural incompatibility which should only occur on a Raspberry Pi 1 which is ARMv6 vs ARMv7 where Debian is built for. I should have mentioned this nonetheless.

What is the output of:

cat /proc/cpuinfo

Sorry, I think I made a mistake.

cat /proc/cpuinfo
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : half thumb fastmult vfp edsp java tls 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 000e
Serial          : 0000000009771b7f
Model           : Raspberry Pi Model B Rev 2

No worries. Unfortunately the Raspberry Pi 1 is not supported. On the Raspberry Pi 1 you are limited to Raspbian packages only. You can’t use any (armhf) packages made for ‘regular’ Debian.

Saved my day. I was installing Home Assistant Core of a freshly installed RPi3B and as it required Python3.8 for the virtual env this article saved it.
Thanks again.

Please note that Debain Bullseye discontinued Python 3.8 and focuses on Python 3.9 only. So therefore I wasn’t able to provide any backport updates beyond 3.8.7.

This also means that, once Debian Bullseye releases (which will be in a couple of months), you will have to upgrade to Python 3.9 and recreate your venv again. Although this was inevitable, please be aware of this.

I am trying to install Python 3.8 following these instructions on a Raspberry Pi 3. I downloaded and installed Raspberry Pi OS using Raspberry Pi Imager to a new microSD card and then started working through your steps.

When I got to the third command,

deb http://deb.pascalroeleven.nl/python3.8 buster-backports main

I got an error message

bash: deb: command not found

Can you give me an idea how to proceed?

Sorry, I failed to completely read the instructions, and have now edited sources.list as you clearly stated.

–Bill

I see you have deleted your post now, but the repo indeed seems broken. To save bandwith on my server I redirect the downloads to Github. Apparently they don’t like that.

But you might be interested in upgrading to Debian Bullseye as well. Python 3.9 is included there so no backport is needed anymore.

Sorry, I assumed you had intentionally shut it down, since also the Github repo was archived. There was a dependency sadly still holding me back from upgrading to bullseye, but it seems I might be able to work around it.

No not yet. I don’t provide any updates anymore though, that’s why the repo is archived.

I’ve found out the problem has to do with the new URL encoding from Github. Apt-get decodes the url (or does not encode it) and then tries to resolve it. If you try to download the packages with wget, there is no problem. So for now if you really want this packages, you download them manually from Index of /python3.8/pool/main/p/python3.8 and install them like this:

sudo apt install ./[package1].deb ./[package2].deb 

You have to download all python dependencies (lib*) manually as well though.

I will keep thinking of a solution though (and hope this is still a temporary change).

If anyone is still interested: I have removed the (not working) redirects from my repository and you can use it again. I think the highest demand is over, so bandwidth shouldn’t be that big of a deal anymore.