On Wed, Jul 16, 2008 at 6:12 AM, Angela Rivera Campos <[EMAIL PROTECTED]> wrote:
> Hi, again
>
> I've trying to install everything, from the begining on another machine,
> this one's running openSUSE 10.3. So I've installed the latest versions of
> numpy, scipy and matplotlib and I've discovered something new which also
> happens in the first machine, the one with openSUSE 10.2. The first time I
> imported pylab this is what I got:
>
> ---------------------------------
>>>> from pylab import *
> /usr/lib/python2.5/site-packages/gtk-2.0/gtk/__init__.py:69: GtkWarning:
> could not open display

If you cannot open the display, most likely it is because either you
are running as root (bad, bad) or you are running over a remot
connection (ssh) and do not have X11 forwarding properly enabled or
configures.  If you want to use mpl with an interactive window, you
will need to have access to the display.  The fact that you see this
error only on the first time you import pylab is typical of exceptions
that are thrown at module import time -- python only tries to import
once so you see the exception only once.  To solve this, trying
running as a normal user rather than root or sudo, and if you are on a
remote machine, try using ssh -X to enable X11 forwarding.  We will
need to know more about exactly what you are doing to help.

> So googling a bit, I've found that to avoid this error an option would be to
> add, before the pylab import, the following:
>
>>>> import matplotlib
>>>> matplotlib.use('Agg')
>
> This way the results floating problem disappears and I've got the correct
> tuples, though now I can't make my script show the figure I'm trying to
> plot. Is this related with matplotlibrc configuration? I haven't modified
> this file and the only lines that are not commented are
>
> backend      : GTKAgg
> numerix      : numpy  # numpy, Numeric or numarray
>
> Running my script with and without these lines with --verbose-debug, I've
> found that when they're written I get: backend agg version v2.2
> and when they are not: backend GTKAgg version 2.10.6

This isn't a problem with matplotlib, but with the connection to the
display as I mentioned above.
Hopefully once you get the display problem sorted out, all will be
well.  Let us know.

JDH

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to