Help fixing post OS upgrade

I upgraded my debian 12 to debian 13 (trixie). When I rebooted the vm tljh was down. When I checked the logs I found /opt/tljh/hub/bin/python3: No module named jupyterhub

I figured the issue was that since the OS upgraded python from 3.11 to 3.13, I needed to reinstall tljh.

However running bootstrap.py I get the following error

/opt/tljh# python3 bootstrap.py --version=latest
Existing TLJH installation detected, upgrading…
Upgrading pip…
Ran /opt/tljh/hub/bin/pip install --upgrade pip with exit code 1
Traceback (most recent call last):
File “/opt/tljh/hub/bin/pip”, line 5, in
from pip._internal.cli.main import main
ModuleNotFoundError: No module named ‘pip’

Traceback (most recent call last):
File “/opt/tljh/bootstrap.py”, line 516, in
main()
~~~~^^
File “/opt/tljh/bootstrap.py”, line 480, in main
run_subprocess([hub_env_pip, “install”, “–upgrade”, “pip”])
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/tljh/bootstrap.py”, line 172, in run_subprocess
raise subprocess.CalledProcessError(cmd=cmd, returncode=proc.returncode)
subprocess.CalledProcessError: Command ‘[’/opt/tljh/hub/bin/pip’, ‘install’, ‘–upgrade’, ‘pip’]’ returned non-zero exit status 1.


Manually running pip with python3 /opt/tljh/hub/bin/pip gives me no error, but running with /opt/tljh/hub/bin/pip python complains that the module pip could not be found.

Do you guys know of a way to fix this without nuking the entire tljh installation?

I don’t know of a way. A Python virtualenv is tightly bound to the python version used to create it, some compiled packages have to be built for a particular python version.

So, what’s the procedure if I want to upgrade the OS? Do I delete everything and reinstall from scratch or is there a way to preserve the configs?

Your should be able to backup any config files. If you want to recreate your environments you can get the list of packages using pip freeze and/or conda list, but it may not be possible to install the same package versions as they may not be compatible with your new Python version.

Ah awesome! So I just backup the old files, delete the old installation, install the new version, copy the old configs and finally reinstall my custom dependencies?

That sounds like a solid plan. Reinstalling from scratch is usually the cleanest way to fix virtualenv breakages after a major OS upgrade like that. Just make sure you double-check your config.yaml and any custom systemd overrides before you wipe the old /opt/tljh directory.