Solution to install python 3.11 on ha core [Dev container home assistant dev]

Hi,

I assume you you are on windows and have an environment set up on vscode, wsl2 and docker desktop.

The new core version core-2023.6.1 shows a message that asks for python 3.11.

Solution :
Install portainer in your docker.

open the home assistant container
launch the console.
You can now install python 11 with

sudo apt update
sudo apt install software-properties-common wget
wget https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tar.xz
sudo tar -xf Python-3.11.4.tar.xz
cd Python-3.11.4
sudo ./configure --enable-optimizations
sudo make altinstall

be patient…

python 3.1 is installed without the necessary pip dependencies.

I downloaded them from a working home assistant and created an int requirement.txt file which I stored here

Download it in your container (I did it by ftp with wget)
then type

pip install --upgrade pip
install pip -r requirement.txt

be patient again. (you can stop after the message)

INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking

restart Vscode and type select python interpreter in the command palette and chose python 3.11

1 Like

This is the wrong solution.
3.10 is only deperecated, development should still target 3.10 until its removed.
At that point the devcontainer will switch to 3.11.

2 Likes

Barely two months later, and with Home Assistant Core 2023.8 there is now a hard requirements for Python 3.11.