How to remove Python 2 in 16.04?
195,294
As there are still a lot of packages that depend on Python2 (like Samba and VirtualBox) you should have a close look at the packages that apt wants to remove before you let it proceed.
Use
sudo apt purge python2.7-minimal
to completely remove Python2 and everything that depends on it.
Related videos on Youtube
Author by
WoJ
Updated on September 18, 2022Comments
-
WoJ over 1 year
Ubuntu has dropped Python 2 in 16.04. It is still installed after an upgrade, though (it was not part of the "obsolete packages").
Is there a clean way to remove Python 2 and all its dependencies in a clean way (to completely get rid of it)?
Is an
apt purge
the way to go?root@ubuntu ~# apt purge python2.7 Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libnss-ldap Use 'apt autoremove' to remove it. The following packages will be REMOVED: auth-client-config* ldap-auth-client* ldap-auth-config* libpam-ldap* libsmbclient* ndiff* python* python-bs4* python-chardet* python-crypto* python-dnspython* python-html5lib* python-ldb* python-lxml* python-ntdb* python-pkg-resources* python-samba* python-setuptools* python-six* python-talloc* python-tdb* python2.7* samba* samba-common-bin* samba-dsdb-modules* samba-libs* samba-vfs-modules* smbclient* winbind* 0 upgraded, 0 newly installed, 29 to remove and 0 not upgraded. After this operation, 58.4 MB disk space will be freed.
-
mikewhatever about 8 yearsWhat exactly do you mean by "clean way"? Python2 is only installed if some of the packages need it. Removing it might break the system.
-
WoJ about 8 years@mikewhatever: I did an upgrade from 15.10 where Python 2 was needed by the system. Since 16.04 does not ship it at all it means it is not needed anymore. So removing Python 2 should not break the system - which is what I fear the most. As for extra software - it does not matter if they break (I will remove them as well in that case)
-
mikewhatever about 8 yearsWell, good luck then. :~)
-
WoJ about 8 years@BharadwajRaju: wouldn't
apt purge
show me the dependencies? - and allow me to make up my mind (in my casesamba
would be a problematic package to remove for instance) -
Admin about 8 years@WoJ I mean't that you don't need it yet. However, so many apps depend on it that it is going to be installed sooner or later.
-
-
Fran Marzoa almost 7 yearsI just did it, and many things got uninstalled. So far the only I'm missing is "duplicity", so my deja-dup backup copies are now broken because deja-dup relies on duplicity. It seems there's still not a duplicity version that supports python 3, and they keep doing changes with python 2.7, so it's unlikely it's going to be one anywhere in the near future. It's somehow a shame because deja-dup is the default backup system in Ubuntu.
-
Fran Marzoa almost 7 yearsJFTR, the pulseaudio-equalizer also seem to depend on Python2 still...
-
Fran Marzoa almost 7 yearsCalibre ebook application also depends on python 2.7
-
Fran Marzoa almost 7 yearsThe Gimp also depends on python 2.7
-
yukashima huksay over 6 yearsYou should never do this! I did it and now my system is all fucked up!
-
Defozo about 6 yearsI'm here because I wanted to run an app with Python 3.6+.
-
fabio.sang about 6 yearsI read the comment too late....
-
peterh about 3 yearsThe correct package name is
libpython2-minimal
, notpython2-minimal
.