Chris Green writes: > I have recently upgraded my desktop system from ubuntu 19.10 to ubuntu > 20.04. [ ... ] > The error I am getting is:- [ ... ] > ImportError: No module named gtk > > So what do I need to install on my Ubuntu 20.04 system to provide the > gtk module?
Ubuntu doesn't provide python-gtk any more at all. Which makes a number of programs rather difficult now ... > Alternatively (but much harder work) what is the Python 3 equivalent > of the the Python 2 pygtk and gtk modules. ... because there is no close equivalent. In Python 3, GTK is accessed via something called GObject Introspection (module "gi") which requires significant changes to code beyond the usual 2to3 Python migration. You might be able to get the program working using pygtkcompat. Try inserting these lines near the beginning of the program: from gi import pygtkcompat pygtkcompat.enable() pygtkcompat.enable_gtk(version='3.0') If that doesn't work, you might be able to get the old Python 2/GTK 2 packages working by installing these two files with dpkg -i. No warranty of safety or efficacy implied. http://mirrors.kernel.org/ubuntu/pool/universe/p/pygtk/python-gtk2_2.24.0-6_amd64.deb http://mirrors.kernel.org/ubuntu/pool/universe/g/gimp/gimp-python_2.10.8-2_amd64.deb Good luck! It was a nasty shock discovering that Ubuntu had removed python-gtk, especially since they kept lots of other python2 packages (I could have understood it if they'd removed python2 entirely). I don't know what the reasoning was for removing python-gtk while keeping python2. ...Akkana -- https://mail.python.org/mailman/listinfo/python-list