[Numpy-discussion] [Matplotlib-users] installing numpy, matplotlib, scipy from source on a Mac

belinda thom bthom at cs.hmc.edu
Wed Jan 10 19:35:07 CST 2007


Hi Chris, Robert, ...?,

I'm glad you reminded me to make sure the path was right, b/c this  
time, I had forgotten to run the "Update Shell" command that came w/ 
MacPython2.4. This gave me:

lrwxr-xr-x 1 root wheel 67 Jan 7 14:29 /usr/local/bin/pydoc@ - 
 > ../../../Library/Frameworks/Python.framework/Versions/2.4/bin/pydoc
lrwxr-xr-x 1 root wheel 70 Jan 7 14:29 /usr/local/bin/pydoc2.4@ - 
 > ../../../Library/Frameworks/Python.framework/Versions/2.4/bin/ 
pydoc2.4
lrwxr-xr-x 1 root wheel 68 Jan 7 14:29 /usr/local/bin/python@ - 
 > ../../../Library/Frameworks/Python.framework/Versions/2.4/bin/python
lrwxr-xr-x 1 root wheel 71 Jan 7 14:29 /usr/local/bin/python2.4@ - 
 > ../../../Library/Frameworks/Python.framework/Versions/2.4/bin/ 
python2.4
lrwxr-xr-x 1 root wheel 69 Jan 7 14:29 /usr/local/bin/pythonw@ - 
 > ../../../Library/Frameworks/Python.framework/Versions/2.4/bin/pythonw
lrwxr-xr-x 1 root wheel 72 Jan 7 14:29 /usr/local/bin/pythonw2.4@ - 
 > ../../../Library/Frameworks/Python.framework/Versions/2.4/bin/ 
pythonw2.4
lrwxr-xr-x 1 root wheel 70 Jan 7 14:29 /usr/local/bin/smtpd.py@ - 
 > ../../../Library/Frameworks/Python.framework/Versions/2.4/bin/ 
smtpd.py
lrwxr-xr-x 1 root wheel 73 Jan 7 14:29 /usr/local/bin/smtpd2.4.py@ - 
 > ../../../Library/Frameworks/Python.framework/Versions/2.4/bin/ 
smtpd2.4.py

Nevertheless, the python I was using in the prior email looks like  
the same as what I'm using w/these path updates, that is, assuming  
version strings are enough to know:

   From prior run:
   Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
   [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin

   New run:
   Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
   [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin

As you'd suspected, it is indeed the case that:

    diff pythonw python

reports no differences. So, I went back and retried the plotting w/wx  
as a backend and discovered that wx FAILS with PYTHONW and PYTHON  
(appended).

If you saw how many notes I've collected on the different installs  
I've tried you'd laugh (except that its not funny). Its no wonder I  
can't keep all this stuff straight. (When I first embarked on this  
exercise several months ago, I tried macports; everything seemed to  
work fine, but the Wx backend failed---I remember something about a  
bitmap, so it was likely the same error I'm having now; and  
unfortunately w/the macports python, the tk/tcl stuff didn't come  
wrapped, so TkAgg was not an option).

After an email w/Robert, I switched to MacPython. As a result, I now  
have TkAgg working (and its using Aqua instead of that awful, klunky  
looking Tk stuff).

Fortunately (ha!), I have three versions of this stuff installed on 3  
different Macs (a G4, a G5, and an Intel). So I can say with safety  
that, using TkAgg backend, here's what's still not working:

1) Using macpython matplotlib, numpy, and scipy packages, you can't  
run scipy.test(); complaint: RuntimeError: module compiled against  
version 1000002 of C-API but this version of numpy is 1000009
2) Using superpak, everything (except ipython) worked out of the box,  
PROVIDED I had already installed the necessary fortran pieces (I used  
g77v3.4-bin.tar.gz, found somewhere on the scipy site).
3) Using Robert's install-from-source method (this install used  
gfortran.bin.tar.gz, with the caveat that the expected WXAgg doesn't  
work)

Machines 2 and 3 are enough to get me back to the real work I have to  
do. But it is obvious there's several real issues for Mac users who  
wish to use the scipy/numpy/matplotlib route. This coming summer I  
may have more time to devote to this stuff, and since it really irks  
me that there isn't a clean way to do this, I may end up figuring out  
how to make the needed binaries myself. In the meantime, I thought  
I'd never wish I was still using Windows...

Thanks to everyone for the time spent on this. And for posterity's  
sake, when you use matplotlib with Numeric, it also crashes. I've  
verified that behavior on Machines 1 and 2 above.

--b

54 % pythonw
Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
history mechanism set up
 >>> import pylab as P
 >>> import matplotlib as M
 >>> M.rcParams['interactive']
True
 >>> M.rcParams['backend']
'WXAgg'
 >>> P.plot([1,2,3])
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/backends/backend_wx.py", line 1048, in _onPaint
self.draw(repaint=False)
<snip>
draw_if_interactive()
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/backends/backend_wx.py", line 1172, in  
draw_if_interactive
figManager.canvas.draw()
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/backends/backend_wxagg.py", line 63, in draw
self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the  
wx.Bitmap
 >>

55 % python
Python 2.4.4 (#1, Oct 18 2006, 10:34:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
history mechanism set up
 >>> import pylab as P
 >>> import matplotlib as M
 >>> M.rcParams['interactive']
True
 >>> M.rcParams['backend']
'WXAgg'
 >>> P.plot([1,2,3])
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/backends/backend_wx.py", line 1048, in _onPaint
self.draw(repaint=False)
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/backends/backend_wxagg.py", line 63, in draw
self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the  
wx.Bitmap
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/pylab.py", line 2022, in plot
<snip>
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/backends/backend_wx.py", line 1172, in  
draw_if_interactive
figManager.canvas.draw()
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/backends/backend_wxagg.py", line 63, in draw
self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the  
wx.Bitmap
 >>>


On Jan 10, 2007, at 3:06 PM, Christopher Barker wrote:

>
>
> Robert Kern wrote:
>
>> Try running with pythonw.
>
> That's probably not it -- as of MacPython 2.4, pythonw ands python  
> are the same.
>
> belinda thom wrote:
>> And running w/pythonw does what it should :-).
>
> OK, now I'm confused:
>
> $ ls -l /Library/Frameworks/Python.framework/Versions/2.4/bin/ 
> python2.4
> -rwxrwxr-x   1 root  admin  39936 Apr  7  2006 /Library/Frameworks/ 
> Python.framework/Versions/2.4/bin/python2.4
>
> $ ls -l /Library/Frameworks/Python.framework/Versions/2.4/bin/ 
> pythonw2.4
> -rwxrwxr-x   1 root  admin  39936 Apr  7  2006 /Library/Frameworks/ 
> Python.framework/Versions/2.4/bin/pythonw2.4
>
> Those two look like the same binaries to me -- and diff tells me  
> they are.
>
> Are you sure you're running the same python with "python" and  
> "pythonw"? Try running them on the command line alone and see what  
> you get.
>
>>    File "/Library/Frameworks/Python.framework/Versions/2.4/lib/  
>> python2.4/site-packages/matplotlib/backends/backend_wxagg.py",  
>> line  63, in draw
>>      self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(),  
>> None)
>> MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create  
>> the  wx.Bitmap
>
> This looks like the error we usually get when you've built the  
> wxAgg extension against a different version of wx than the one  
> you're running. That's easy to do, as Apple has provided an old wx  
> with it's Python, it is often found by default by the MPL build  
> process.
>
> Search this list for the way to fix that, or, if you really can't  
> find it, I'll dig it up.
>
> -Chris
>
>
>
>
>
>
>
>
> -- 
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> Chris.Barker at noaa.gov



More information about the Numpy-discussion mailing list