[Matplotlib-users] how to use X11, not the "Python" app, on Mac OS X?

2008-04-16 Thread Jeremy Hill
Hello matplotlib-users,

I've just managed to get numpy, scipy, ipython and matplotlib running  
under ActivePython 2.5 on my Intel Mac.

But I'd like matplotlib to use just X11, and not the Aqua-wrapped  
thing with the rocket icon (app name "Python"): I want to be able to  
ssh -X into my mac, run ipython in an xterm, and see matplotlib  
figures in my X-window manager. At the moment, I've tried a few  
different matplotlib backends, but for some (WX, WXAgg, Tk)  
matplotlib pops up with its nice rocket icon on the physical screen  
of my mac, even when I'm sshing in from elsewhere, whereas for others  
(Agg, Agg2, Cairo), nothing pops up anywhere. Perhaps changing  
backends is not the right approach, and I should be doing something  
more fundamental...?

Apologies if I've missed something obvious---it's not a very  
searchable problem. Googling and/or searching this list for "macos  
x11 matplotlib" reveals that most people seem to want to go the other  
way and eliminate their dependency on X11.

Below I've pasted an example of what I've been trying, followed by my  
platform and installation info.

Thanks in advance for any pointers.   cheers, --jez






backend = 'Cairo'
import matplotlib
matplotlib.use(backend)
import pylab,numpy
pylab.plot(numpy.arange(0,10))
pylab.show()


Mac OS X 10.4.11 on 2.16 GHz Intel Core 2 Duo
Python 2.5.2 (r252:60911, Mar 27 2008, 17:40:23)
wget 'http://downloads.activestate.com/ActivePython/macosx/2.5/ 
ActivePython-2.5.2.2-macosx.dmg'
open ActivePython-2.5.2.2-macosx.dmg
numpy.__version__ = '1.1.0.dev5038'
svn co http://svn.scipy.org/svn/numpy/trunk numpy
cd numpy
python setup.py build
sudo python setup.py install
matplotlib.__version__ = '0.91.2'
wget 'http://surfnet.dl.sourceforge.net/sourceforge/matplotlib/ 
matplotlib-0.91.2.tar.gz'
tar xfvz matplotlib-0.91.2.tar.gz
cd matplotlib-0.91.2
python setup.py build
sudo python setup.py install
cairo.version = '1.4.12'
sudo port install cairo # installed cairo 1.4.14
wget 'http://cairographics.org/releases/pycairo-1.4.12.tar.gz'
tar xfvz pycairo-1.4.12.tar.gz
cd pycairo-1.4.12
./configure --prefix=`python -c "import sys; print sys.prefix"`
make
sudo make install

-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to use X11, not the "Python" app, on Mac OS X?

2008-04-16 Thread Jeremy Hill
Thanks, Nadia, for the offline info. I've got to admit, installing  
something as big and dependency-ridden as Python by hand would  
probably take things way beyond my level.

I tried installing python25 via fink (BTW, I'm using Tiger, not  
Leopard), and then installing the latest ipython, numpy, scipy and  
matplotlib using the naive 'python setup.py build; sudo python  
setup.py install' method on top of that. Fink tells me that tcltk[|- 
dev|-shlibs] 8.4.13-3 are installed.

The good news is that the packages install and import, and after  
specifying backend 'TkAgg', pylab.show() opens an X-Window, not an  
Aqua window. So that confirms that X11-based libraries are being used  
at some level.

The bad news is, it segfaults immediately after the window opens.


I've also tried going the WX and GTK routes under fink's python25,  
but always hit a brick wall sooner or later, either in the  
installation (wxPython---long, nasty story) or at runtime (fink's  
pygtk-py25 installs OK, but at 'import pylab' I get a bunch of gtk  
assertion failures followed by a 'Bus Error')

Ah well.  Thanks for your help. Given how short life is, I've settled  
on the following solution:

import matplotlib
matplotlib.use('Pdf')
import pylab
...
pylab.savefig('/tmp/blah.pdf')
!xpdf /tmp/blah.pdf &

and then keep re-saving (and pressing 'reload' in the xpdf window)  
whenever I would normally do pylab.draw().  Some might consider this  
a nasty workaround, but I'm used to those---I've used Matlab for years.



-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to use X11, not the "Python" app, on Mac OS X?

2008-04-16 Thread Jeremy Hill
On 17 Apr 2008, at 4:39 am, Jed Frechette wrote:

> Any reason you're manually installing from source rather than using  
> the Fink
> packages? Fink's matplotlib is still at 0.90 but the latest  
> versions of all
> the other packages you want are in Fink. Note that you will need to  
> enable
> Fink's Unstable tree to get these packages as its Stable tree is quite
> outdated.


Hmm, very good point. Mainly it was due to a general suspicion of  
fink and the desire to use it as little as possible. Partly it was  
due to the fact that my fink was long overdue for a selfupdate, and  
this was masking the fact that recent versions of all these things  
were available.

So I selfupdated and installed matplotlib-py25 via fink. Initially I  
got bus errors whenever importing pylab, but this turned out to be  
due to files hanging over from the previous matplotlib installation.

After cleaning up and re-installing, it all works X11-ly. Many thanks!


-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users