0

TLDR: I need to restore my distro after sudo removing all Python dependencies

I did the stupid thing and now I need to fix it. I wanted to do a clean install of Python for a class, uninstalling all programs that I installed using the command our teacher gave us (basically, remplacing apt-get install in the line he gave us to install Python with apt-get remove). So I ran the following:

sudo apt-get remove python3 libfreetype6-dev python3-pip python3-virtualenv

And, not paying enough attention to the list of dependencies that were going to be deleted, I went on with the command. Now I am left without Kubuntu, but KDE is still installed (it seems so, at least): I can still use the GUI + access Dolphin, Discover... I also installed Mozilla using sudo apt-get install without any issues and can go on the internet. In turn, it seems like apt-get is working. I haven't tried anything since.

This topic has been adressed a few times :

Instead of asking the same question once more, I'll ask what's the best way to go around restoring Kubuntu 20.04 after sudo remove-ing Python? There seems to be three ways to do this:

sudo apt-get install --reinstall python python-chardet python-colorama python-distlib python-django python-django-tables2 python-six python-html5lib python-lxml python-minimal python-pkg-resources python-setuptools python-urllib3 python-requests python-pip python-virtualenv

sudo apt-get install --reinstall python-dnspython

sudo apt autoremove

sudo apt-get -f install

This would reinstall everything python-related that I've deleted and then I should be able to reinstall Kubuntu without any issues. But I'm not sure I should run autoremove since there's a huge list of extra packages that would be removed. Any extra input on that matter?

  • (no. 2): Installing the entire list of packages that I deleted running my apt-get remove command. The list comes from /var/log/apt/history.log (see bottom of the post for the list, it's a long one). Would this restore everything, or would reinstalling them (using apt-get) somehow change things from the way they were before? There is also a list of packages that are not longer used since running my sudo apt-get remove command, which apt-get recommanded me to get rid of using autoremove (smelling something fishy I did not run autoremove!) (I can update my post with this list, if it's of any use).

  • (no. 3): Doing a clean install of Kubuntu from a live USB key. It seems overkill, but since I saved all my files to a hard drive before trying to solve my problem, it wouldn't be too much of a hassle.

Which option would work best / be the easiest? Obviously, I'm pretty unexperienced with the command line (although a very enthusiastic Linux user), so the easiest option would (no. 1) would be the best for me. Anything else I should be watching out? Thanks so much for your input !!

The list of dependencies removed by apt-get:

  foomatic-db-compressed-ppds gdal-bin gnome-control-center gnome-menus gnome-online-accounts gnome-user-docs gvfs-backends
  hplip hplip-data ibus indicator-applet indicator-bluetooth kio-extras kubuntu-desktop kubuntu-notification-helper
  kubuntu-settings-desktop language-selector-common language-selector-gnome libfreetype6-dev libsmbclient lsb-release muon
  netplan.io networkd-dispatcher openprinting-ppds pastebinit plasma-desktop plasma-desktop-data
  plasma-discover-backend-snap plasma-discover-snap-backend plymouth-theme-kubuntu-text plymouth-theme-ubuntu-text
  printer-driver-foo2zjs printer-driver-foo2zjs-common printer-driver-m2300w printer-driver-postscript-hp
  printer-driver-ptouch printer-driver-pxljr printer-driver-sag-gdi python3 python3-appdirs python3-apport python3-apt
  python3-aptdaemon python3-aptdaemon.gtk3widgets python3-attr python3-automat python3-bcrypt python3-blinker python3-brotli
  python3-cairo python3-certifi python3-cffi-backend python3-chardet python3-click python3-colorama python3-commandnotfound
  python3-constantly python3-cpuinfo python3-crypto python3-cryptography python3-cups python3-cupshelpers python3-dateutil
  python3-dbus python3-dbus.mainloop.pyqt5 python3-debian python3-decorator python3-defer python3-dev python3-distlib
  python3-distro python3-distro-info python3-distupgrade python3-distutils python3-dns python3-entrypoints python3-filelock
  python3-gdal python3-gdbm python3-geoip python3-gi python3-gi-cairo python3-gpg python3-gssapi python3-hamcrest
  python3-httplib2 python3-hyperlink python3-ibus-1.0 python3-idna python3-ifaddr python3-importlib-metadata
  python3-incremental python3-jwt python3-kerberos python3-keyring python3-launchpadlib python3-lazr.restfulclient
  python3-lazr.uri python3-ldb python3-lib2to3 python3-libtorrent python3-lz4 python3-lzo python3-macaroonbakery
  python3-mako python3-markupsafe python3-more-itertools python3-nacl python3-netifaces python3-nose python3-numpy
  python3-oauthlib python3-olefile python3-opengl python3-openssl python3-paramiko python3-pexpect python3-pil python3-pip
  python3-pkg-resources python3-problem-report python3-protobuf python3-ptyprocess python3-pyasn1 python3-pyasn1-modules
  python3-pygame python3-pymacaroons python3-pyqt5 python3-rencode python3-renderpm python3-reportlab
  python3-reportlab-accel python3-requests python3-requests-unixsocket python3-rfc3339 python3-samba python3-secretstorage
  python3-service-identity python3-setproctitle python3-setuptools python3-simplejson python3-sip python3-six
  python3-software-properties python3-systemd python3-talloc python3-tdb python3-tk python3-twisted python3-twisted-bin
  python3-tz python3-uno python3-update-manager python3-uritools python3-urllib3 python3-virtualenv python3-wadllib
  python3-wheel python3-xapian python3-xdg python3-xkit python3-yaml python3-zeroconf python3-zipp python3-zope.interface
  samba-common-bin samba-dsdb-modules samba-libs sddm smbclient snapd software-properties-common software-properties-gtk
  software-properties-qt system-config-printer system-config-printer-common system-config-printer-udev
  ubuntu-advantage-tools ubuntu-docs ubuntu-drivers-common ubuntu-minimal ubuntu-release-upgrader-core
  ubuntu-release-upgrader-qt ubuntu-standard ubuntu-system-service ufw unattended-upgrades unity-control-center
  update-manager-core usb-creator-common usb-creator-kde vlc-plugin-samba xorg xpra xserver-xorg yelp```

1 Answer 1

2

There is no "best way".

sudo apt install kubuntu-desktop^ should do it. If it does not work, you will have to reinstall.

Never mess up with the default python. You can install additional versions of python and use a virtualenv.

2
  • Thanks ! I guess I learnt not messing with Python the hard way... I'll try this and if anything seems to be malfunctionning, I'll keep the list of deleted files at hand and reinstall them. Do you know wheteher I should avoid running autoremove so I don't delete anything extra?
    – paulhector
    Jul 28, 2021 at 11:49
  • First install kubuntu-desktop. Unless you remove important meta packages, autoremove should not remove any required packages. Jul 28, 2021 at 12:45

You must log in to answer this question.

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