Is it safe to remove Python 2.7.15rc1 from Ubuntu 18.04?

5,309

Run

apt purge -s python2.7

where -s is a simulation of what would happen.

and see for yourself what else you will lose.

On my system, Kubuntu 18.04, here's what I see:

The following packages were automatically installed and are no longer required:
  gir1.2-appindicator3-0.1 gir1.2-gtk-vnc-2.0 gir1.2-keybinder-3.0 gir1.2-libosinfo-1.0 gir1.2-libvirt-glib-1.0 gir1.2-spiceclientglib-2.0
  gir1.2-spiceclientgtk-3.0 gir1.2-vte-2.91 libgovirt-common libgovirt2 libgtk-vnc-2.0-0 libgvnc-1.0-0 libkeybinder-3.0-0 libphodav-2.0-0
  libphodav-2.0-common libspice-client-glib-2.0-8 libspice-client-gtk-3.0-5 libusbredirhost1 libvirt-glib-1.0-0 spice-client-glib-usb-acl-helper
  syslinux-common virt-viewer xsltproc
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  boot-repair* boot-sav* boot-sav-extra* glade2script* kubuntu-settings-desktop* python* python-asn1crypto* python-cairo* python-certifi*
  python-cffi-backend* python-chardet* python-cryptography* python-dbus* python-enchant* python-enum34* python-gi* python-gi-cairo*
  python-gobject* python-gobject-2* python-gtk2* python-gtkspellcheck* python-idna* python-ipaddr* python-ipaddress* python-libvirt*
  python-libxml2* python-libxslt1* python-mutagen* python-openssl* python-pkg-resources* python-psutil* python-qt4-dbus* python-requests*
  python-six* python-urllib3* python-xdg* python2.7* ranger* recoll* terminator* trash-cli* virt-manager* virtinst* zim*
0 upgraded, 0 newly installed, 44 to remove and 0 not upgraded.

 

I won't be removing python2.7.


Looking further into this, one can find out what is present in a clean installation of Ubuntu 18.04, as opposed to an upgrade from an earlier version, by looking at /var/log/installer/initial-status.gz. I have such a system.

From a terminal window, run:

$ zgrep "Package: python2.7" /var/log/installer/initial-status.gz

The search will be empty indicating that no package containing the string python2.7 was installed.


In your case, since you upgraded from 16.04 to 18.04:

  • If you do have python-2-7-15rc1 on your system, it means it was retained from your previous system as part of the upgrade or that you subsequently installed software that depended on it.

  • Either way, removing such a package in 18.04 is safe with the caveat that programs depending on it that you installed (a) when using the previous system (before the upgrade) or (b) after the upgrade maybe removed.

  • Keep in mind that during the life of 18.04, if you install something like calibre or gimp or variety or virt-manager, doing so will bring python2.7 back.

Share:
5,309

Related videos on Youtube

Jaswitha Reddy
Author by

Jaswitha Reddy

Updated on September 18, 2022

Comments

  • Jaswitha Reddy
    Jaswitha Reddy over 1 year

    I upgraded my laptop from Ubuntu 16.04 to Ubuntu 18.04 as soon as I got it and I am not using Python 2.

    Is it safe for me to remove it?

    My terminal is showing the default version as Python 3.7.3.

    • Admin
      Admin almost 5 years
      why the need to remove those few Mbs? did you check what software you currently have that is using 2.7? There in lies is your answer ;-) What is you definition of safe? It won't make your laptop explode. That's for sure. It won't make it burn to ashes. It might make it crash but if you are able to restore it (heck even a reinstall) and you have a backup... what do you call "safe"?
    • Admin
      Admin almost 5 years
      I want to uninstall it because I don't use it. I want to know if it will crash or somehow affect my laptop.
    • Admin
      Admin almost 5 years
      @JaswithaReddy if that is your motivation, don't do it! Never! Sure, it's an interesting question, philosophically :) There is no point in doing it, you don't win anything at all.
  • Jaswitha Reddy
    Jaswitha Reddy almost 5 years
    Thank you for the answer. I don't think I will be uninstalling python2.7 anytime soon.
  • Jaswitha Reddy
    Jaswitha Reddy almost 5 years
    I am getting a lot of packages related to amd64 when I ran the simulation code you gave. Any idea what that it?
  • DK Bose
    DK Bose almost 5 years
    If you see :amd64 it refers to the architecture. You probably have a 64-bit OS. uname -a will help.
  • qwr
    qwr almost 5 years
    amd64 refers to any x86-64 even if you have an intel processor