Upgraded Python; Do I have to reinstall all site-packages manually?

Viewed 8743

I have upraded my Linux distro recently. Python 3.5 was replaced by Python 3.6.

All site packages I have installed with pip3 are still in the /usr/lib/python3.5/site-packages directory and Python does not find them there now, because it looks in .../python3.6/site-packages obviously.

I see the directory contents and I could manually install them again, but that does not look to me like the right way to do it. I could move the contents to the new directory, but again, this seems to me incorrect either.

How am I supposed to handle it properly?

Should I have prepared a pip3 freeze list before the upgrade?

I tried to search, but the keywords are probably too general and got many unrelated answers.

3 Answers

I just hit the same problem upgrading from Python 3.6 to Python 3.7, I forgot to run pip freeze before I upgraded to Python 3.7. The solution that worked is to specify the --path option as the old site-packages/ directory (which was not deleted):

pip3 freeze --path /usr/local/lib/python3.6/site-packages/ > python3.6_requirements.txt
pip3 install -r python3.6_requirements.txt
Related