pygtk not available on Focal Fossa (20.04)? [duplicate]
tl;dr I cannot install pygtk
on Focal Fossa (Ubuntu 20.04) anymore but need it for my self-written PyGTK-based Python application.
I wrote a Python2 application some years ago based on GTK using the pygtk
package. This worked fine for years now, I could always use the available Python2 installations, even when Python3 was the more modern variant.
With Focal Fossa (Ubuntu 20.04) Python2 support has been dropped, so I thought, no problem, I can upgrade my application to Python3. After doing it, I tried to install pygtk
for Python3 using sudo pip3 install pygtk
but this failed:
$ sudo pip3 install pygtk
Collecting pygtk
Using cached pygtk-2.24.0.tar.bz2 (2.4 MB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nezwkvr_/pygtk/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nezwkvr_/pygtk/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-nezwkvr_/pygtk/pip-egg-info
cwd: /tmp/pip-install-nezwkvr_/pygtk/
Complete output (4 lines):
********************************************************************
* Building PyGTK using distutils is only supported on windows. *
* To build PyGTK in a supported way, read the INSTALL file. *
********************************************************************
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
(The mentioned pygtk-2.24.0.tar.bz2
file wasn't to be found anymore, so I could not even look at the INSTALL
file as suggested.)
I also found no package for apt install ...
that would have installed it.
Alright, I thought, back to Python2. But unfortunately I cannot install pygtk
for Python2 as well. I can install a python2
package, but there is no pip
command and/or module anymore for Python2. (So neither pip ...
nor pip2 ...
nor python2 -m pip
work. Maybe I just didn't find the correct way to do it.)
So I also could not install the Python2 version.
Then I briefly tried looking up how to install a non-packaged version of pygtk but that quickly dove even deeper into more dependencies (jhinstall
, etc.) which seemed like taking even more time, and I'm lacking the experience in solving all these.
So I guessed maybe there is an easier solution and maybe someone here knows how to easily solve this issue. If nothing here pops up I will have to invest the time and solve the dependencies the hard way.
You can install python-gtk2
manually from 18.04 LTS repository:
cd ~/Downloads
wget 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
and use it as usual :)