[Pythonmac-SIG] py2app with matplotlib

Brian Zambrano brianz at gmail.com
Wed Feb 4 08:20:07 CET 2009


On Mon, Feb 2, 2009 at 11:00 PM, Brian Zambrano <brianz at gmail.com> wrote:

> When I do:
>
> brianz at omaha$ ls -F
> dist/plot_in_wx_test.app/Contents/Resources/lib/python2.5/
> config@            matplotlib/        site-packages.zip
> lib-dynload/       numpy/             site.py@
>
> Yet, when I try to run
> ./dist/wx_mpl_dynamic_graph.app/Contents/MacOS/wx_mpl_dynamic_graph I get an
> import error....the application appears to know nothing about any type of
> matplotlib:
>
>   File
> "...../dist/wx_mpl_dynamic_graph.app/Contents/Resources/wx_mpl_dynamic_graph.py",
> line 31, in <module>
>     import matplotlib
> ImportError: No module named matplotlib
>

After some hunting and digging I solved this.  After upgrading Python 2.5.1
which comes in OS X 10.5 to Python 2.5.4, all is well.

I found this out in a roundabout way....first I got it working after
realizing the path was off when the App fired up.  The libraries were ending
up in

dist/plot_in_wx_test.app/Contents/Resources/lib/python2.5/

which wasn't in sys.path.  What *was* in sys.path was:

dist/plot_in_wx_test.app/Contents/Resources/lib/python2.5/site-packages

After a little hackery I got it working.  Then I realized that Python wasn't
being included in the build so upgraded to 2.5.4 (which wasn't as simple as
I hoped).  After that, the build worked no problem.  Hopefully this will be
useful to someone else.

BZ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20090203/f1cfae0a/attachment.htm>


More information about the Pythonmac-SIG mailing list