RuntimeError: could not open display (matplotlib port)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RuntimeError: could not open display (matplotlib port)

Michael Broe

~/Desktop/MPLexamples $ python
Python 2.4.2 (#1, Mar 31 2006, 13:50:42)
[GCC 4.0.0 (Apple Computer, Inc. build 5026)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> print '\n'.join(sys.path)

/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/
python24.zip
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/plat-darwin
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/plat-mac
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/plat-mac/lib-scriptpackages
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/lib-tk
/opt/local/lib/python2.4/lib-dynload
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages
/opt/local/lib/python2.4/site-packages
/opt/local/lib/python2.4/site-packages/Numeric
/opt/local/lib/python2.4/site-packages/gtk-2.0
/Users/michael/Library/Python/2.4/site-packages
/opt/local/lib/python2.4/site-packages
/opt/local/lib/python2.4/site-packages
 >>>


~/Desktop/MPLexamples $ python coords_demo.py
Traceback (most recent call last):
   File "coords_demo.py", line 7, in ?
     from pylab import *
   File "/opt/local/lib/python2.4/site-packages/pylab.py", line 1, in ?
     from matplotlib.pylab import *
   File "/opt/local/lib/python2.4/site-packages/matplotlib/pylab.py",  
line 199, in ?
     import backends
   File "/opt/local/lib/python2.4/site-packages/matplotlib/backends/
__init__.py", line 19, in ?
     globals(),locals(),[backend_name])
   File "/opt/local/lib/python2.4/site-packages/matplotlib/backends/
backend_gtkagg.py", line 11, in ?
     from backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
   File "/opt/local/lib/python2.4/site-packages/matplotlib/backends/
backend_gtk.py", line 21, in ?
     from backend_gdk import RendererGDK
   File "/opt/local/lib/python2.4/site-packages/matplotlib/backends/
backend_gdk.py", line 31, in ?
     import gtk, pango
   File "/Users/michael/Desktop/MPLexamples/__init__.py", line 38, in ?

RuntimeError: could not open display

Any ideas? Thanks in advance for your help.
Cheers,
Mike
_______________________________________________
Darwinports mailing list
[hidden email]
http://www.opendarwin.org/mailman/listinfo/darwinports
Reply | Threaded
Open this post in threaded view
|

Re: RuntimeError: could not open display (matplotlib port)

Arnaud Delobelle

On 1 Apr 2006, at 17:24, Michael Broe wrote:
[snip]
>     import gtk, pango
>   File "/Users/michael/Desktop/MPLexamples/__init__.py", line 38, in ?
>
> RuntimeError: could not open display
>
> Any ideas? Thanks in advance for your help.

To eliminate the obvious: where are you running python from?
If it's from Terminal.app, then you need to make sure X11 is running  
and you should  set your DISPLAY environment accordingly.

If you're in an xterm then I don't know :)

--
Arnaud


_______________________________________________
Darwinports mailing list
[hidden email]
http://www.opendarwin.org/mailman/listinfo/darwinports
Reply | Threaded
Open this post in threaded view
|

Re: RuntimeError: could not open display (matplotlib port)

Michael Broe

On Apr 1, 2006, at 1:05 PM, Arnaud Delobelle wrote:
>
> To eliminate the obvious: where are you running python from?
> If it's from Terminal.app, then you need to make sure X11 is  
> running and you should  set your DISPLAY environment accordingly.

Thank you, I am running from Terminal.app, and I wasn't running X11.  
Error removed.

Now I have new problems:

$ python coords_demo.py
Traceback (most recent call last):
   File "coords_demo.py", line 7, in ?
     from pylab import *
   File "/opt/local/lib/python2.4/site-packages/pylab.py", line 1, in ?
     from matplotlib.pylab import *
   File "/opt/local/lib/python2.4/site-packages/matplotlib/pylab.py",  
line 199, in ?
     import backends
   File "/opt/local/lib/python2.4/site-packages/matplotlib/backends/
__init__.py", line 19, in ?
     globals(),locals(),[backend_name])
   File "/opt/local/lib/python2.4/site-packages/matplotlib/backends/
backend_gtkagg.py", line 16, in ?
     from _gtkagg import agg_to_gtk_drawable
ImportError: No module named _gtkagg

and also

$ ipython -pylab
pygtk.require() must be called before importing gtk
PyGTK version 1.99.16 or greater is required to run the GTK  
Matplotlib backends

But:

$ port info gtk2
gtk2 2.8.16, x11/gtk2 (Variants: darwin_6, darwin_8)

$ port info py-gtk2
py-gtk2 2.8.4, python/py-gtk2 (Variants: glade, darwin_7)


Thanks for the help!
Mike
_______________________________________________
Darwinports mailing list
[hidden email]
http://www.opendarwin.org/mailman/listinfo/darwinports