Upgrade on Debian

I run a server with debian 9, with indico, and try to upgrade it to debian 10

After the upgrade of postgresql and the debian, I was unable to run pip under indico user.

Anyone have experience of that ?

When I try to run pip under indico user, I got this message. I check the path are correct, it’s indeed the rigth python it launch

indico@indico:~$ source .venv/bin/activate
(.venv) indico@indico:~$ pip
Traceback (most recent call last):
  File "/opt/indico/.venv/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/opt/indico/.venv/local/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 6, in <module>
    import logging
  File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module>
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections
  File "/usr/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref
(.venv) indico@indico:~$

My guess would be that your Python installation somehow got messed up by the debian upgrade. Deleting and recreating the virtualenv would probably be a good first step (you need to pip install indico and any plugins you use again afterwards).

I though about that, so I resync the all .venv from a snapshot, and did not solve the problem.

Restoring the venv from a backup will not help for sure, since the problem is the combination of the existing the venv and the updated Python (make sure you actually have Python 2 and didn’t end up with Python 3 as /usr/bin/python - a virtualenv usually has a symlink to the original python interpreter, and a Python 2 virtualenv pointing to a Python 3 interpreter could cause all kinds of weird issues).

Ok. It seems it’s working. Thank a lot.
Do you recommand to do that in every upgrade ?

No, only if something weird happens to the Python environment…

A python are a snake…it’s always weird…:wink:

Sorry…could’n resist :wink:

Thanks !!!