[Numpy-discussion] Packaging numpy with py2app

Josh Marshall josh.p.marshall at gmail.com
Sun Jul 16 19:22:07 CDT 2006

Back in December last year, I was building a PyObjC application that  
embedded numpy (scipy_core at the time), scipy and matplotlib. I ran  
into a few issues doing so, some of which were resolved. One was the  
inability for scipy to run from a zipped site-packages. I worked  
around this by expanding the embedded site-packages.zip into a site- 
packages directory in the same location. For reference, the thread  
can be found at:

Come a few months later, I have needed to update to the latest  
version of numpy (and therefore scipy and matplotlib). I have not yet  
updated to the universal build of Python, still running 2.4.1,  
although I will do so if it is known to fix any issues. (I don't have  
too much time at the moment, and building the latest versions of  
numpy and matplotlib for a universal build scares me).

I managed to get it working again, which required:
1) Setting packages=['matplotlib','numpy'] in setup.py's options for  
2) Modifying the py2app/apptemplate/lib/site.py file to include  
'sys.path.append(_parent + '/site-packages')' before the same line  
with .zip appended to the file name.
3) Adding setup_options['options']['py2app']['includes'].extend 
(['pytz.zoneinfo.UTC']) to the setup.py, this is required by matplotlib.

I believe (2) is a bug in py2app (I am running 0.3.1). Packages  
included using 'packages=' are not added to site-packages.zip, but  
rather are in their own site-packages directory. I am not sure  
whether this is the intended behaviour or a bug, but it is good for  
me, since numpy and matplotlib won't run when compressed.

Now, it seems I am doomed to continue to have to find work-arounds to  
get numpy and matplotlib working in a standalone .app. Is there a  
chance we can come up with a py2app recipe for numpy, matplotlib and  
scipy? What other alternatives are there?


More information about the Numpy-discussion mailing list