I recently updated from Ubuntu 16.04 to 18.04.
I had separate partitions for / and home, and for the update I made a clean install over the / folder, so that I saved everything in the home folder, while the rest was formatted.
After the update, I only had python 3.6.7, which as I understand is the default version for the operative system. Then, I installed python 2.7 (version 2.7.15rc1, specifically), so I was expecting to have only these two versions installed.

  1. Am I correct in saying that the 3.6.7 is the default version for Ubuntu 18.04? So, no matter what, this version is needed from the system, and should not be uninstalled?

  2. As I said, I was expecting to have only python 3.6.7 and 2.7.15rc1 installed. However, after a search, I found these files:

    /snap/core/6130/usr/bin/python3.5: Python 3.5.2
    /snap/core/6130/usr/bin/python3.5m: Python 3.5.2
    /snap/core/6259/usr/bin/python3.5: Python 3.5.2
    /snap/core/6259/usr/bin/python3.5m: Python 3.5.2
    /snap/core/6350/usr/bin/python3.5: Python 3.5.2
    /snap/core/6350/usr/bin/python3.5m: Python 3.5.2

    are they relics from before the update? Are they system files? Can they be removed, and how? I don't understand what these folders contain, since as I said I formatted the / partition. If I give the command:

    snap list

    I get:

    Name                  Version                 Rev   Tracking  Publisher   Notes
    core                  16-2.37.1               6350  stable    canonical✓  core
    gnome-3-26-1604       3.26.0                  74    stable/…  canonical✓  -
    gnome-calculator      3.30.1                  260   stable/…  canonical✓  -
    gnome-characters      3.30.0                  139   stable/…  canonical✓  -
    gnome-logs            3.30.0                  45    stable/…  canonical✓  -
    gnome-system-monitor  3.30.0                  57    stable/…  canonical✓  -
    gtk-common-themes     0.1-4-g88bc1b2          818   stable/…  canonical✓  -
    skype                      66    stable    skype✓      classic
    spotify       31    stable    spotify✓    -
    vlc                   3.0.6                   770   stable    videolan✓   -

    which are the programs I installed from the software center after the update to 18.04.

  3. If I use the command:

    whereis pip

    I get the output

    /home/carlo/.local/bin/pip /home/carlo/.local/bin/pip2.7

    which is almost surely from before the update (I did not delete the /home partition when updating to Ubuntu18.04). But how can I uninstall it?

    If I try:

    sudo apt-get remove python-pip

    I obtain the result (something like this, my system is in Italian, I'm translating):

    "python-pip" is not installed and cannot be removed

    so, apt.-get is not finding the version of pip I want to remove from the /home folder. Same goes when using Synaptic, python-pip results not to be installed. How do I remove it?

  • 4
    obligatory xkcd: xkcd.com/1987 – and this does not even cover snap!
    – dessert
    Feb 3, 2019 at 13:25
  • 3
    Please edit your question to include the complete output of snap list
    – user535733
    Feb 3, 2019 at 15:05
  • I have similar problem. I think pip2 was installed when creating virtualenv. Apr 28, 2019 at 5:57

2 Answers 2

  • (2) Are from snap core package and you have 3 versions installed: 6130, 6259, 6350

    They don't interfere with system wide programs, they are only used for other snap packages.

  • (3) It is a locally installed Python2, that will take priority and better to get rid of it if you don't need it.

    If you still have the downloaded source, use the uninstall command. If not then you have to make manual remove.


apt-get / apt (side-note: no actual difference of the two, see What is the difference between apt and apt-get?) is independent from the individual packages you might install (which is logical at second sight). See apt-get install for different python versions. That is on purpose.


+++EDIT: It seems that the solution for pip does not work, since I got a "Permission denied" after really executing the example commands.+++ Also see this that has no answer.

If you want to uninstall an old pip, you should use

python2.7 -m pip uninstall pip for getting rid of pip2.7 (for example). and yes, "pip2.7 can uninstall pip2.7", this as a proof:

~/myfoldername $ pip -V
pip 20.3.1 from /home/myusername/myfoldername/venv/myvirtualenvironment/lib/python2.7/site-packages/pip (python 2.7)

~/myfoldername $ python2.7 -m pip uninstall pip 
DEPRECATION: Python 2.7 reached the end of its life on January 1st,
2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. Found existing installation: pip 20.3.1 Uninstalling pip-20.3.1:   
Would remove:
Proceed (y/n)? n 


~/myprojectname $ python3.7 -m pip uninstall pip 
Found existing installation: pip 20.3.3 Uninstalling pip-20.3.3:   Would remove:
Proceed (y/n)? n


Of course, that is not possible for python itself, you need: sudo apt-get remove python2.7

~/myfoldername $ sudo apt-get remove python2.7
0 upgraded, 2 newly installed, 402 to remove and 1 not upgraded.
Need to get 97,3 kB of archives.
After this operation, 387 MB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
 ?] n

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .