Skip navigation.

ImportError: No module named gtk

Many of the ROX applications are written in Python. They require the Python PyGTK library in order to use the GTK toolkit (which provides windows, buttons and menus, etc, for programs). If it is not installed correctly, you may see:

ImportError: No module named gtk

PyGTK installation hints

Most Linux distributions include packages for PyGTK (the python-gtk2 package on Debian, for example), so check your distribution CDs for a copy first. Otherwise, the web-site has more information.

Warnings compiling pygtk: Warnings are printed for each C function that pygtk doesn't support. You can safely ignore these messages. Some modules (such as libgl and libglade) are only built if present. None of the ROX applications use them at present, so you can ignore these messages too! Finally, if you get an error about your version of automake, try just running make again...

Python2.2 or later must be the default version: if you must keep an older version as the default, you'll have to edit the first line of each application's AppRun file, changing 'python' to 'python2.2'.

PyGTK not found after installing: On some systems, you may need to use the --prefix argument to configure to ensure that pygtk gets installed to the same prefix as python (either /usr or /usr/local).

AttributeError: 'module' object has no attribute 'Window' PyGTK is not installed correctly. Try reinstalling. For more details, see this rox-users thread:

For more help with PyGTK, please see the PyGTK mailing list or the PyGTK FAQ.

Testing your PyGTK installation

To test your installation, try running Python manually from a terminal emulator (xterm, gnome-terminal or similar) and importing gtk yourself, as follows:

$ python
Python 2.3.5 (#2, Jun 19 2005, 13:28:00) 
[GCC 3.3.6 (Debian 1:3.3.6-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtk; pygtk.require('2.0')
>>> import gtk
>>> gtk.Window
<type 'gtk.Window'>

If you get errors while doing this, then there is a problem with your installation that is not related to ROX; please ask your distribution for help.

Syndicate content