-2

I have confused to uninstall python3 or fix my VPS Ubuntu

Im using Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-31-generic x86_64)

I tried to uninstall all python packages

sudo apt-get purge python3

And getting this error

dpkg: error processing package python3-pkg-resources (--remove):
 subprocess installed pre-removal script returned error exit status 127                               Processing triggers for libc-bin (2.23-0ubuntu10) ...
Errors were encountered while processing:
 python3-lxml
 python3-pip
 python3-apt
 python3-pyparsing
 gir1.2-ibus-1.0:amd64
 hplip-data
 python3-blinker
 python3-bs4
 python3-cairo
 python3-chardet
 python3-dbus
 python3-defer
 python3-feedparser
 python3-gi
 python3-guacamole
 python3-httplib2
 python3-idna
 python3-jwt
 python3-louis
 python3-markupsafe
 python3-padme
 python3-setuptools
 python3-problem-report
 python3-ptyprocess
 python3-pyasn1
 python3-pycurl
 python3-six
 python3-wheel
 python3-xdg
 python3-xkit
 python3-xlsxwriter
 dh-python
 python3
 python3-pkg-resources
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried other way from other site,error still same And i tried to reinstall my ubuntu with command line

apt-get install --reinstall ubuntu-desktop

I dont know should i do to fix my ubuntu and reinstall my python.

Note: I tried to run python3 it not working with reasons python3 is not package and i run python3.7 it working fine,idk python3.7 thats reall python package i have or something else :/

Im so appreciate any help

  • Im just want to uninstall and reinstall it,bcz before what i do that i have some error, – katro coplax Jan 25 '19 at 13:58
  • Don't this is a terrible idea, python3 is a dependency for so much (I think even apt is a dependency) edit: Gah someone beat me to it – j-money Jan 25 '19 at 13:58
  • 4
    Removing Python 3 will destroy the operational state of your system because so many things depend on it. DO NOT remove Python 3 from your system. Instead, address the actual errors you're seeing, rather than assume that Python 3 being present is the cause. – Thomas Ward Jan 25 '19 at 14:32
0

Ubuntu 16.04 comes with Python3 installed by default. If you want to install Python 2 you can run:

sudo apt install python-minimal

On the command line you should use python3 or python2 to execute scripts.

Also take note that ubuntu-desktop is a package that will install a full display system such as X server and Gnome packages, none of which you'll have much use for if connecting over SSH.

However, the problem you may have now is that you've attempted (or succeeded to some degree) in removing Python, which is actually what the package management tool apt uses to install/remove packages.

  • Doesn't 16.04 come with Python 2 installed? I thought 17.10 was the first release not to. – wjandrea Jan 25 '19 at 14:38
  • 1
    I thought so too, but I actually fired up 16.04.5 in a VM and it's not there by default at least with a server installation, only python3 was. – Kristopher Ives Jan 25 '19 at 15:26
0

This seems like an XY-problem. Problem Y, uninstalling Python 3, will break your OS. Don't do that.

Problem X is not clear, but assuming it's that the system Python 3 executable is damaged, you can reinstall it via the package python3.5-minimal:

sudo apt-get install --reinstall python3.5-minimal
  • If you've "successfully" removed python3 you cannot actually run most apt commands. – Kristopher Ives Jan 25 '19 at 15:27
  • @Kristopher Good point. I assume the output in the question indicates that no action was taken, but I might be wrong. – wjandrea Jan 25 '19 at 15:30

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