Ubuntu 20.04 ImportError: No module named gtk.glade

5,319

The python-gtk2 with python-glade2 may be installed manually using packages from 18.04 LTS by the commands below:

cd ~/Downloads
wget -c http://archive.ubuntu.com/ubuntu/pool/universe/p/pygtk/python-gtk2_2.24.0-5.1ubuntu2_amd64.deb
sudo apt-get install ./python-gtk2_2.24.0-5.1ubuntu2_amd64.deb

wget -c http://archive.ubuntu.com/ubuntu/pool/universe/p/pygtk/python-glade2_2.24.0-5.1ubuntu2_amd64.deb
sudo apt-get install ./python-glade2_2.24.0-5.1ubuntu2_amd64.deb
Share:
5,319
Kyeiv
Author by

Kyeiv

Updated on September 18, 2022

Comments

  • Kyeiv
    Kyeiv over 1 year

    i am trying to launch an old python2 script. On ubuntu 18.04 i installed python-glade2 and it worked, unfortunately ubuntu 20.04 doesn't have it in repositories. Is there a way to get this gtk.glade module? Maybe some other library that provides it?

    @edit: after following N0rbert's suggestions gtk/glade are installed but, unfortunately I also need python-gdal which I was trying to install in a similiar way and got error:

    The following packages have unmet dependencies. python-gdal : Depends: gdal-abi-2-2-3 but it is not installable Depends: libgdal20 (>= 2.2.2) but it is not installable E: Unable to correct problems, you have held broken packages.

    I assume that some packages from Ubuntu 20 that i need conflicts with the ones from ubuntu 18.

    output of apt-cache policy python-gdal libgdal20:

    python-gdal: Installed: (none) Candidate: (none) Version table: libgdal20: Installed: (none) Candidate: (none) Version table:

    I am wondering if downloading .debs from ubuntu 18, then extracting only .py files and copying them into script directory is an only option here –

    • N0rbert
      N0rbert over 3 years
      Try to run sudo apt-get dist-upgrade to get newest dependencies for current Ubuntu version.
    • Kyeiv
      Kyeiv over 3 years
      it doesn't change apt-cache policy output. I think it's because python2 bindings are obsolete so the dependency libs were withdrawn
    • N0rbert
      N0rbert over 3 years
      Do you have Gtk part solved? Can you import gtk.glade using python2 ?
    • Kyeiv
      Kyeiv over 3 years
      yes, I no longer get the No module named gtk.glade error.
    • N0rbert
      N0rbert over 3 years
      So lets mark this problem solved (accept below answer). And then ask new question about Gdal.
    • Kyeiv
      Kyeiv over 3 years
      problem from the topic is solved, for the new one I created this thread
  • Kyeiv
    Kyeiv over 3 years
    thank you N0rbert, unfortunately I also need python-gdal which I was trying to install in a similiar way you suggested and got error: The following packages have unmet dependencies. python-gdal : Depends: gdal-abi-2-2-3 but it is not installable Depends: libgdal20 (>= 2.2.2) but it is not installable E: Unable to correct problems, you have held broken packages. I assume that some packages from Ubuntu 20 that i need conflicts with the ones from ubuntu 18
  • N0rbert
    N0rbert over 3 years
    Seems to be unrelated to Gtk issue. But anyway please add output of apt-cache policy python-gdal libgdal20 to the question.
  • Kyeiv
    Kyeiv over 3 years
    python-gdal: Installed: (none) Candidate: (none) Version table: libgdal20: Installed: (none) Candidate: (none) Version table: I am wondering if downloading .debs from ubuntu 18, then extracting only .py files and copying them into script directory is an only option here
  • N0rbert
    N0rbert over 3 years
    Please add such information to question body by editing it. In comments they are hard to read.
  • Kyeiv
    Kyeiv over 3 years
    I have editted the question describing steps done by me