1

When trying to install python-gtk2, I get the following errors:

sudo apt-get install python-gtk2
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:
 python-gtk2 : Depends: python (< 2.8) but 3.4.3-1 is to be installed
               Depends: python:any (>= 2.6.6-7~)
               Depends: python-cairo (>= 1.0.2-1.1) but it is not going to be installed
               Depends: python-gobject-2 (>= 2.21.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

But I have python2.7 installed. When I run python in terminal, it works properly (Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)). What should I do in this situation? Things I have tried include:

  • sudo apt-get -f install

  • sudo apt-get update –fix-missing

  • sudo dpkg –configure -a

After running sudo apt-cache policy python I get this output:

sudo apt-cache policy python
python:
  Installed: 3.4.3-1
  Candidate: 3.4.3-1
  Version table:
 *** 3.4.3-1 100
        100 /var/lib/dpkg/status
     2.7.15~rc1-1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
karel
  • 122,292
  • 133
  • 301
  • 332

1 Answers1

0

What ended up working was:

sudo apt-get install python=2.7.15~rc1-1

Then, after running apt-cache policy python,

python:
  Installed: 2.7.15~rc1-1
  Candidate: 2.7.15~rc1-1
  Version table:
 *** 2.7.15~rc1-1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

and I could install my package. This had the effect of removing my python3.4 I believe.