Removed python3 hoping to reinstall it, but cannot do it

$ cat /etc./issue
$ Ubuntu 18.04.1 LTS

I’ve installed python3.6 and python3.7 from sorces. Now i’m trying to install gnome-terminal (which was for some reason removed along with python3), I fire off the following command:

$ sudo apt-get install gnome-terminal

That line is executed and yields the following output:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 gnome-terminal : Depends: python3 but it is not going to be installed
                  Depends: python3-gi but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

It keeps mentioning python3 but it is installed, I can do:

$ python3 --version
$ Python 3.6.5

If I try:

$ sudo apt-get install python3

I get the following error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3 : PreDepends: python3-minimal (= 3.6.5-3) but it is not going to be installed
           Depends: python3.6 (>= 3.6.5-2~) but it is not going to be installed
           Depends: libpython3-stdlib (= 3.6.5-3) but 3.6.7-1~18.04 is to be installed
E: Unable to correct problems, you have held broken packages.

If I try:

$ sudo apt-get install python3-minimal

I get:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-minimal : Depends: python3.6-minimal (>= 3.6.5-2~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

And so on…what should I do?! I’ve entirely run out of ideas…

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

You could try aptitude.

Install aptitude like this:

sudo apt install aptitude

Or if that didn’t work, download the aptitude .deb package from here for 64 bit and install it like this:

sudo dpkg -i aptitude_0.8.10-6ubuntu1_amd64.deb

Or install the downloaded package by double clicking it so it opens in the GUI package manager (ubuntu-software) and install it from there.

After that, nstall python3 like this:

sudo aptitude install python3

Aptitude is good at resolving dependencies and will most likely succeed in your case.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply