gtk not working

Hi, I'm having a bit of troulbe getting pylab.show() to

    > display a figure drawn with matplotlib.

    > The Test:

    > python import pylab pylab.plot([0,0],[1,1]) pylab.show()

    > I do not recieve an error, though I also do not see the
    > graph.

    > FC4 x86_64 install

    > python-matplotlib-debuginfo-0.87.7-2
    > python-matplotlib-0.87.7-2

    > gtk2-2.6.10-2.fc4.4.i386 gtk2-2.6.10-2.fc4.4.x86_64
    > gtk2-devel-2.6.10-2.fc4.4.i386
    > gtk2-devel-2.6.10-2.fc4.4.x86_64

    > When I build the rpms from the srpm I see the following,
    > though the build continues.

    > pygtk present but import failed pygtk present but import
    > failed

matplotlib build has this annoying problem that it requires an X11
environment to build the GTK runtime code. Often if you are logged in
as su you may not have access to the X display. You need to build in
an environment in which you can do:

python

import gtk

Then mpl should build the gtk backend properly. What you are
currently seeing is that the GTK build is failing which is why you are
getting the runtime error.

JDH

Hi,
   It is correct that the machine I'm building on does not have X11 running, though it is installed. I can, however, enter python and import gtk without error.

[root@...142... examples]# python
Python 2.4.1 (#1, May 16 2005, 15:15:14)
[GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import gtk

[root@...142... examples]#

Adam

···

On Tue, 21 Nov 2006, John Hunter wrote:

   > Hi, I'm having a bit of troulbe getting pylab.show() to
   > display a figure drawn with matplotlib.

   > The Test:

   > python import pylab pylab.plot([0,0],[1,1]) pylab.show()

   > I do not recieve an error, though I also do not see the
   > graph.

   > FC4 x86_64 install

   > python-matplotlib-debuginfo-0.87.7-2
   > python-matplotlib-0.87.7-2

   > gtk2-2.6.10-2.fc4.4.i386 gtk2-2.6.10-2.fc4.4.x86_64
   > gtk2-devel-2.6.10-2.fc4.4.i386
   > gtk2-devel-2.6.10-2.fc4.4.x86_64

   > When I build the rpms from the srpm I see the following,
   > though the build continues.

   > pygtk present but import failed pygtk present but import
   > failed

matplotlib build has this annoying problem that it requires an X11
environment to build the GTK runtime code. Often if you are logged in
as su you may not have access to the X display. You need to build in
an environment in which you can do:

python

import gtk

Then mpl should build the gtk backend properly. What you are
currently seeing is that the GTK build is failing which is why you are
getting the runtime error.

JDH

Hi,
   I'm trying to build FC4 i386 and x86_64 rpms of matplotlib-0.87.7 with GTK and/or GTKAgg backends.

Install Environment:

FC4 i386 gtk+-devel-1.2.10-39
gtk+-1.2.10-39
numpy-1.0-1
numpy-debuginfo-1.0-1
pygtk2-2.6.2-0.fc4.4
pygtk2-devel-2.6.2-0.fc4.4
pygtk2-libglade-2.6.2-0.fc4.4

X11 is currently running on the box.

Snipit of 'rpmbuild -ba python-matplotlib.spec'

import gtk # directory /usr/lib/python2.4/site-packages/gtk-2.0/gtk
# /usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.pyc matches /usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py
import gtk # precompiled from /usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.pyc
dlopen("/usr/lib/python2.4/site-packages/gtk-2.0/gobject.so", 2);
import gobject # dynamically loaded from /usr/lib/python2.4/site-packages/gtk-2.0/gobject.so
# /usr/lib/python2.4/site-packages/gtk-2.0/gtk/keysyms.pyc matches /usr/lib/python2.4/site-packages/gtk-2.0/gtk/keysyms.py
import gtk.keysyms # precompiled from /usr/lib/python2.4/site-packages/gtk-2.0/gtk/keysyms.pyc
dlopen("/usr/lib/python2.4/site-packages/gtk-2.0/gtk/_gtk.so", 2);
# /usr/lib/python2.4/encodings/utf_8.pyc matches /usr/lib/python2.4/encodings/utf_8.py
import encodings.utf_8 # precompiled from /usr/lib/python2.4/encodings/utf_8.pyc
pygtk present but import failed
import gtk # directory /usr/lib/python2.4/site-packages/gtk-2.0/gtk
# /usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.pyc matches /usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py
import gtk # precompiled from /usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.pyc
pygtk present but import failed
TKAgg requires TkInter
# /usr/lib/python2.4/ConfigParser.pyc matches /usr/lib/python2.4/ConfigParser.py
import ConfigParser # precompiled from /usr/lib/python2.4/ConfigParser.pyc
# /usr/lib/python2.4/distutils/command/build.pyc matches /usr/lib/python2.4/distutils/command/build.py
import distutils.command.build # precompiled from /usr/lib/python2.4/distutils/command/build.pyc
running build
running build_py
# /usr/lib/python2.4/distutils/command/build_py.pyc matches /usr/lib/python2.4/distutils/command/build_py.py
import distutils.command.build_py # precompiled from /usr/lib/python2.4/distutils/command/build_py.pyc
creating build

After building the rpm I can then install it and do the following:

Python 2.4.3 (#1, Jun 13 2006, 16:41:18)
[GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import pylab
import gtk

Importing gtk only fails when I run rpmbuild. I can manually enter /usr/src/redhat/SOURCES/matplotlib-0.87.7/ and run 'python setup.py build' and get no errors.

TKAgg requires TkInter
running build
running build_py
running build_ext

What am I doing wrong??

Thanks!
Adam Miller