[Numpy-discussion] [Pythonmac-SIG] Packaging numpy with py2app

Bob Ippolito bob at redivi.com
Sun Jul 16 19:46:06 CDT 2006


On Jul 16, 2006, at 5:22 PM, Josh Marshall wrote:

> 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:
> http://www.scipy.net/pipermail/scipy-dev/2005-December/004551.html
>
> 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).

If you're still using 2.4.1 you're going to want to add  
LSPrefersPPC=True to the plist. Otherwise your app will not run on  
i386, because it will not know to use Rosetta.

> I managed to get it working again, which required:
> 1) Setting packages=['matplotlib','numpy'] in setup.py's options for
> py2app.

That could be handled with recipes, or with eggs when py2app grows  
support for that. Recipes or workarounds are the only way until then.

> 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.

That's a bug, but not the right fix. Trunk is fixed.

> 3) Adding setup_options['options']['py2app']['includes'].extend
> (['pytz.zoneinfo.UTC']) to the setup.py, this is required by  
> matplotlib.

That should be part of a matplotlib recipe.

> 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?

Sure, someone can write the recipes and send me a patch. I don't  
currently use matplotlib, numpy, or scipy nor do I have an example I  
can test with so I'm not going to do it.

-bob





More information about the Numpy-discussion mailing list