Why is Python Preinstalled on Ubuntu?

  • Does the operating system depend on Python?

Try running:

apt-cache rdepends python | grep -v python | wc -l

Since Ubuntu 20.04 uses python3 for default, run:

apt-cache rdepends python3 | grep -v python | wc -l

This basically says "Count the number of packages that depend on Python, NOT counting python specific packages". On my system it's well over 1000 other packages - safe to say Ubuntu depends pretty heavily on Python.

  • One of the dependencies is goldeneye and quick search pop ups saying that's a DoS tool. hmmmm. Maybe it's best to uninstall python after all! Jul 15 '20 at 21:24
  • 1
    @CausingUnderflowsEverywhere there are hundreds of similar tools available in apt's sources. They can be used nefariously of course, but they also have legitimate uses for pentesters and other network security people.
    – Dan Scally
    Jul 15 '20 at 21:26
  • Seems ubuntu server has tons of preinstalled goodies. :) Jul 15 '20 at 21:27
  • 2
    @CausingUnderflowsEverywhere I'm guessing that's sarcasm, but just in case: the GitHub page says it is a HTTP DoS test tool and that it's meant to be used for security testing purposes only (wink-wink, nudge-nudge).
    – l3l_aze
    Jul 15 '20 at 21:35
  • 2
    @el-banto: I guess you are using 20.04 release, you have to replace python with python3 when running the command.
    – abu_bua
    Jul 22 '20 at 14:27

Looking at 20.04, the technical reason is that ubuntu-minimal depends on python3. It would be tough to run Ubuntu without ubuntu-minimal as its description is

This package depends on all of the packages in the Ubuntu minimal system, that is a functional command-line system with the following capabilities:

  • Boot
  • Detect hardware
  • Connect to a network
  • Install packages
  • Perform basic diagnostics

It is also used to help ensure proper upgrades, so it is recommended that it not be removed.

While I expect most of the core Linux programs don't require python, I believe a lot of software that Ubuntu (Canonical) writes is done in python. Things like ubuntu-advantage, landscape, cloud-init, and netplan.

Another common dependency is that there are python apt libraries used by a number of packages. For example, unattended-upgrades is written in python

  • You are right, Canonical likes python. Aug 13 '20 at 8:24

Ubuntu works with python, and without python Ubuntu won't work (actually, I never tested it, but I think it won't work). That's why it's already installed when you load Ubuntu.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.