When people update form Fedora 30 or 31 to Fedora 32, the main Python interpreter is updated form 3.7 to 3.8. I'd like to add a section to the release notes about migrating user pip-installed packages for the new version.
pip
The procedure would be as follows:
$ sudo dnf install python3.7 # the previously main version $ python3.7 -m ensurepip --user # get pip for the previously main version $ python3.7 -m pip list # observe the installed packages $ python3.7 -m pip freeze > installed.txt # save the list with specific versions $ python3 -m pip install --user -r installed.txt # install the same packages for the now default version $ python3.7 -m pip uninstall $(python3.7 -m pip list --user | cut -d" " -f1) # uninstall user installed packages for 3.7 -- this ensures proper removal of files in ~/.local/bin $ rm -rf ~/.local/lib/python3.7/ # optional, cleanup now empty directory structure $ sudo dnf remove python3.7 # optional, remove the unneeded python version
Awesome, thank you @churchyard
For the release notes, cleaning up /usr/local/lib*/python3.7 might be useful, too, in case someone installed system-wide packages.
/usr/local/lib*/python3.7
Before removing the directories, it might also make sense to take a look into them to check if they are empty.
To remove sudo installed packages, you'll need to do this (after the steps above, before dnf removing python3.7):
$ sudo python3.7 -m ensurepip # get pip for the previously main version for root $ sudo python3.7 -m pip list # observe the system-installed packages $ sudo python3.7 -m pip uninstall $(python3.7 -m pip list | cut -d" " -f1) # uninstall installed packages for 3.7 -- this ensures proper removal of files in /usr/local/bin $ sudo rm -rf /usr/local/lib*/python3.7/ # optional, cleanup now empty directory structure
Note that when following the previous steps, they are now already installed for your user, which is the preferred option. A big fat warning should be added to never use sudo pip again. This instructions are special, because they are intended to recover users who already used sudo pip in the past.
sudo pip
Metadata Update from @pbokoc: - Issue assigned to pbokoc
@churchyard just realized, that at least the cleanup instructions are also needed for Python 2
Users still have Python 2.7 installed unless they removed it.
Instructions added in #510, should be online in about an hour.
I split the commands into separate blocks and moved comments out so the steps are easier to copy&paste.
Metadata Update from @pbokoc: - Issue status updated to: Closed (was: Open)
Log in to comment on this ticket.