Matplotlib py2app problems (was Re: matplotlib py2exe problem)

I have the same issue with py2app that is described with py2exe below. In order to work around this, I just needed to remove the "sys.platform=='win32' " check.

Could the developers please either:
Change the line to either:
  if (sys.platform=='win32' or sys.platform=='darwin') and sys.frozen:
or
  if sys.frozen:
Either is fine with me. I'm not sure how this affects linux/other *nix users, but they don't tend to freeze apps, so the second line is probably fine.

Regarding py2exe and zipping the python packages into a zip, (py2app also does this) does anyone have any troubles with freezing numpy and matplotlib? (This may be more relevant to the numpy list.) Numpy fails on import due to the pkgload() command trying to load the documentation. Everything works fine when I unzip the site-packages.zip into a site-packages directory, but I would prefer not to have to do this since it doubles the disk space my .app consumes.

Thanks,
Josh

···

On 2/8/06, Charlie Moad <cwmoad@...287...> wrote:

On 2/7/06, John Hunter <jdhunter@...4...> wrote:

"Daniel" =3D=3D Daniel McQuillen <danmcquillen@...9...> writes:

    > Please be kind....poor starving newbie. I've seen this
    > question posted around but can't seem to find an answer:
    > does anybody have experience creating an .exe for a
    > matplotlib program using py2exe?

    > My testMPL.py application is all set to go, but when I run
    > py2exe with the suggested setup.py file, I get
    > errors. (I'm using ActiveState Python 2.4.2 Build 10)

Daniel, just for our information: are you using the py2exe examples
from the matplotlib FAQ page? I think these are probably a bit out of
date as of the 0.86 release because of the way we recently reorganized
the package data (fonts, thumbnails etc).

Charlie, have you tested any of the new egg / package organization
stuff with py2exe?

I just tried with an old project that I used py2exe with and it does
look like we still need the py2exe specific check in get_data_path
since py2exe zips the pure python code into a library.zip. I updated
my setup.py file for that old project and I am pasting it below. In
my specific case I was using numarray (numpy didn't exist), so now I
have to exclude numpy or errors occur for some unknown reason. I just
added the old py2exe check to get_data_path and everything worked
fine. I will add this to cvs.

Until the next release you can just uncomment the following lines in
matplotlib/__init__.py#_get_data_path():
    if sys.platform=3D=3D'win32' and sys.frozen:
        path =3D os.path.join(os.path.split(sys.path[0])[0], 'matplotlibdat=
a')
        if os.path.isdir(path): return path
        else:
            # Try again assuming sys.path[0] is a dir not a exe
            path =3D os.path.join(sys.path[0], 'matplotlibdata')
            if os.path.isdir(path): return path

Done.

···

On 2/19/06, Josh Marshall <josh.p.marshall@...287...> wrote:

I have the same issue with py2app that is described with py2exe
below. In order to work around this, I just needed to remove the
"sys.platform=='win32' " check.

Could the developers please either:
Change the line to either:
        if (sys.platform=='win32' or sys.platform=='darwin') and sys.frozen: