My mistake was that I pointed python3 away from the initial installation link target /usr/bin/python3.12 to another Python version. Reverting it back to /usr/bin/python3.12 (the default in my Ubuntu 24 installation) resolved the issue. Installing python3-apt did not work.