Removed python3 hoping to reinstall it, but cannot do it

6,329

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.

Share:
6,329

Related videos on Youtube

Albert
Author by

Albert

Updated on September 18, 2022

Comments

  • Albert
    Albert over 1 year
    $ 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...

    • guiverc
      guiverc almost 5 years
      installed from what sources? A Ubuntu sourced package for bionic (packages.ubuntu.com/…) or where? Many Ubuntu tools rely on python to run, and can be problematic if changes are made. I would check your apt logs to see if whatever you installed caused any packages to be removed (which is a clue to what to remove to allow you to get back to what you should have).
    • Albert
      Albert almost 5 years
      I've installed python from here python.org/ftp/python/3.6.5
    • Abhay Patil
      Abhay Patil over 3 years
      Once I did sudo apt autoremove --purge python3.6 on 18.04 LTS, as python 3.8 was already available. And guess what, I couldn't do anything after removing 3.6. And then I decided to reboot, hoping it would fix the issue. Guess what, I was not able to boot. I have to reinstall Ubuntu. LOL
  • Albert
    Albert almost 5 years
    Oh thanks dude, you've saved my day! Quick and effective solution. It did help me. At least I'm now able to get my terminal back.
  • pbhj
    pbhj almost 5 years
    You'll avoid a lot of problems by using official sources for installs sudo apt install python3 instead of downloading bundles and installing manually. Aptitude is good at dependency resolution, as you've found out.