Upgrading from Raspbian Bullseye to Bookworm - wvhn/smarthome GitHub Wiki

There are certain limitations in Bookworm with Python 3.11 which forces users to set up virtual reqirements and is not fully tested with smarthomeNG v1.10. So it is recommended to use Python 3.9 or 3.10 for smarthomeNG until release of v1.11.

Unfortunately I had still be using smarthomeNG with Python3.7 under Bullseye and had not not installed it with Python3.9 nor installed all required Python Packages. This caused some extra work after the upgrade. So I recommend to install all required Python 3.9 modules under Bullseye and set up smarthomeNG to run in Python 3.9 before the upgrade to Bookworm. Python-venv should be installed with Python 3.9, too. If this is fulfilled, the likeliness of an easy start of smarthomeNG in Python 3.9 after the upgrade is quite high.

I followed this instruction for the OS upgrade. It went quite smoothly but I recommend to skip apt autoremove and apt autoclean in the end and check the packages manually after finishing all other installation steps of smarthomeNG.

With sudo ln -sfn /usr/bin/python3.9 python3 I switched the default Python version to v3.9. Since Python 3.9 had not been installed completely before the OS upgrade I ran into some problems with pip version and missing dependencies "distutils" and "lib2to3". I found the dependencies for Python 3.9 in /var/cache/apt/archives and installed them using sudo dpkg - i .... This breaks Python 3.11 installation. I copied the folder "/lib/python3.9/distutils" and ".../lib2to3" to backup folders and then repaired the Python 3.11 installation with sudo sudo apt --fix-broken install.

Now I was able to start smarthomeNG under Python 3.9 and install the missing requirements. If pip should be missing it can be installed with the script get-pip.py.

After all I wanted to test virtual environments. The make of a venv failed because of a missing ensure-pip module. This post helped me out.

Switching Python to v3.11 and installing smarthomeNG in a virtual environment, I ran into new problem: pip did not respect the option in pip.conf to use PiWheel but tried to build scipy from scratch. On one of my sytsems it helped to increase the swap size according to this solution. On the second Pi this did not help and so I installed scipy manually using the option -i https://www.piwheels.org/simple in the pip command.