Python 3.10 backport for Debian 11 bullseye
Just like two years ago, I have created backport packages for Python for the current Debian stable distribution. My previous backport was a huge success with thousands of downloads and was also used in some other projects beside Home Assistant. This time I have backported Python 3.10 for Debian 11 bullseye.
I am pretty sure there are still plenty of people (like me) who are using Home Assistant Core on Debian without Docker. Of course you can also still install Python from source but this is generally not the best practice and you won’t receive any updates.
Home Assistant 2023.2.0 has dropped support for Python 3.9 so now we are forced to use Python 3.10 or newer. Debian bullseye doesn’t have Python 3.10 however and Debian bookworm (which will contain Python 3.11) will not be released anytime before July 2023. In the meantime, you can use the packages from this backport.
The scope of this project is limited to backporting just Python 3.10 itself. So no defaults (which provide virtual packages so
python3 get’s automatically linked to
python3.10) and no precompiled pip-packages or wheels. Therefore it can coexist with your regular Python (3.9) installation without any interference and still being simple to maintain. It’s main use is for in virtual environments where you can use pip to compile and install any packages you desire. It does provide all the packages and dependencies needed to create a Python 3.10 virtual environment.
So if you want something to use Python 3.10, just execute the command as
python3.10 instead of
Although Debian 12 at the moment still provides Python 3.10, it will not be available at release. Instead Python 3.11 will be the supported Python version for Debian 12. Therefore I am not sure if the maintainers will provide Python 3.10 updates in the mean time. If they do, I will update this backport as well. Once Python 3.11 has matured in Debian bookworm, I may provide backports for that as well so it will be easy to upgrade to bookworm later.
Usage for Home Assistant Core
The usage of my packages is tested for people who followed the Install Home Assistant Core advanced guide.
You can follow the steps below to add my repository to your system and then follow that guide while replacing every instance of
python3.10 to get a working virtual environment. There are two differences:
- There is no
python3.10-pippackage. We are using pip from Debian bullseye which works just fine.
- Once you have activated the virtual environment, you’ll have to upgrade
setuptoolsas the version in Debian bullseye is not compatible with Python 3.10:
pip3 install --upgrade setuptools
So if you already used that guide before, you only have to install
sudo apt install python3.10 python3.10-venv python3.10-dev
Existing users of a Home Assistant virtual environment created with a different Python version must recreate the environment. This can take a very long time, especially if there are no wheels available for your architecture. Upgrading an existing environment is difficult/impossible. It is however possible to create an environment while Home Assistant is running in a different directory, stop Home Assistant and swap them out to minimize downtime.
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 by adding this line to your sources.list:
deb http://deb.pascalroeleven.nl/python3.10 bullseye-backports main
You should also add my PGP (which you can get from my website via https) to APT’s sources keyring:
wget -qO- https://pascalroeleven.nl/deb-pascalroeleven.gpg | sudo tee /etc/apt/trusted.gpg.d/deb-pascalroeleven.gpg
Chain of trust (sort of)
Packages are built using Github actions along with a file containing the checksums of all packages. Therefore, you can compare the checksums of the packages in the repository with the checksums in Github Actions and trace the entire process (up to 90 days after the build after which the artifacts and logs get removed). This way, if you trust the Github Actions build system, you can be sure that the packages I provide are actually built using the instructions in this repo.
Currently there is support for
armhf architectures. The
amd64 packages are build natively while the
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.
If there is a demand for a different architecture, I might add that one as well.
The Raspberry Pi 1 is not supported as it uses a different processor architecture than what Debian builds for.
Extra note for people running on
There is no wheel of the bcrypt dependency available for
armhf in PyPI (there is for
aarch64)), so we must build this package ourselves. Home Assistant 2023.2.0 bumped the bcrypt dependency to version 4.0.1. However this version requires rustc >= 1.56 which is also not available in Debian bullseye.
This can be fixed by installing rustc via rustup in your home directory (or in the home directory of the home assistant user if you have one) for example. Once you reload your terminal (or run
source $HOME/.cargo/env) and run
rustc --version, you should have a rust version greater then 1.56 available. Installing this and using it required 2 GB on my system however!
For more technical details, you can checkout Github
If something is unclear or if you have any problems, please let me know! I consider myself a somewhat advanced system administrator and I might have skipped over some non-trivial steps somehow.