minimal size of frozen wxPython app?

a simple cxFreeze of a wx "hello world" is about 15MB / 6MB compressed - a big app not much bigger :-). With UPX a little better.

    1724416 gdiplus.dll (perhaps removable)
     782946 main.exe
     655872 MSVCR90.dll
    2134016 python26.dll
      11776 select.pyd
     966144 wx._controls_.pyd
     976896 wx._core_.pyd
     743424 wx._gdi_.pyd
     675328 wx._misc_.pyd
     669696 wx._windows_.pyd
     122368 wxbase28uh_net_vc.dll
    1305088 wxbase28uh_vc.dll
     729600 wxmsw28uh_adv_vc.dll
    3165696 wxmsw28uh_core_vc.dll
     479744 wxmsw28uh_html_vc.dll

guess py2exe is not significantly less ?

simply removing even things like wxmsw28uh_html_vc , ,*net_vc, breaks the thing.
Is there a chance to further significantly reduce the size, e.g. by some simple manual detachments in the python tree of the wx package, or even in the C code?
With numpy for example I was able to reduce from 10MB/4MB packed to ~300k with relatively simple means. It seems not to be so easy here. But maybe somebody has already tried that, or has an idea?

Also: is wxPython still compilable for python2.3 ?

Robert

Robert wrote:

a simple cxFreeze of a wx "hello world" is about 15MB / 6MB compressed - a big app not much bigger :-). With UPX a little better.

   1724416 gdiplus.dll (perhaps removable)
    782946 main.exe
    655872 MSVCR90.dll
   2134016 python26.dll
     11776 select.pyd
    966144 wx._controls_.pyd
    976896 wx._core_.pyd
    743424 wx._gdi_.pyd
    675328 wx._misc_.pyd
    669696 wx._windows_.pyd
    122368 wxbase28uh_net_vc.dll
   1305088 wxbase28uh_vc.dll
    729600 wxmsw28uh_adv_vc.dll
   3165696 wxmsw28uh_core_vc.dll
    479744 wxmsw28uh_html_vc.dll

guess py2exe is not significantly less ?

simply removing even things like wxmsw28uh_html_vc , ,*net_vc, breaks the thing.
Is there a chance to further significantly reduce the size, e.g. by some simple manual detachments in the python tree of the wx package, or even in the C code?
With numpy for example I was able to reduce from 10MB/4MB packed to ~300k with relatively simple means. It seems not to be so easy here. But maybe somebody has already tried that, or has an idea?

Some rearranging of the core modules and the build process would probably result in the ability to trim stuff out, but as far as I know nobody has experimented with that yet. For example, if the wxPython extensions were rearranged such that their dividing lines were the same as the wx DLLs (like putting all the stuff that references wx html into the html.pyd) then you could leave out the html DLL if you're not using it.

Also: is wxPython still compilable for python2.3 ?

The core should be, however there are a few things in the wx.lib and demo modules that use language or python lib features added in 2.4 or 2.5. So as long as you are not using any of those modules it would probably work ok with 2.3.

···

--
Robin Dunn
Software Craftsman

Robert,

a simple cxFreeze of a wx "hello world" is about 15MB / 6MB compressed - a big app not much bigger :-). With UPX a little better.

   1724416 gdiplus.dll (perhaps removable)
    782946 main.exe
    655872 MSVCR90.dll
   2134016 python26.dll
     11776 select.pyd
    966144 wx._controls_.pyd
    976896 wx._core_.pyd
    743424 wx._gdi_.pyd
    675328 wx._misc_.pyd
    669696 wx._windows_.pyd
    122368 wxbase28uh_net_vc.dll
   1305088 wxbase28uh_vc.dll
    729600 wxmsw28uh_adv_vc.dll
   3165696 wxmsw28uh_core_vc.dll
    479744 wxmsw28uh_html_vc.dll

guess py2exe is not significantly less ?

simply removing even things like wxmsw28uh_html_vc , ,*net_vc, breaks the thing.
Is there a chance to further significantly reduce the size, e.g. by some simple manual detachments in the python tree of the wx package, or even in the C code?
With numpy for example I was able to reduce from 10MB/4MB packed to ~300k with relatively simple means. It seems not to be so easy here. But maybe somebody has already tried that, or has an idea?

Also: is wxPython still compilable for python2.3 ?

Robert

I haven't used that script yet, but py2exe (through GUI2Exe) must do a better job as I made a simple program with 245 lines and when I compiled it, I ended up with 12 files or approx. 2.46 MB. I probably need to add at least one MS related dll which would bump the size up to 3+ MB, but that's still a lot less than what you ended up with.

If you like you could post the code you're using and I can run it through GUI2Exe and post my results as well as the flags I set.

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

Dear Mike & ALL,

If you like you could post the code you're using and I can run it through
GUI2Exe and post my results as well as the flags I set.

I would appreciate that -- I am as yet not much experienced with
GUI2Exe, but will have to get to it quite soon.

Also, regarding the quest for a simple way to create installation
packages for distributing cross-platform Python applications, has
anyone already considered InstallJammer
(http://www.installjammer.com/)? I have not tried it myself, but looks
promising.

Best regards,

···

2009/5/26 Mike Driscoll <mike@pythonlibrary.org>:

--
Dr. Mauro J. Cavalcanti
Ecoinformatics Studio
P.O. Box 46521, CEP 20551-970
Rio de Janeiro, RJ, BRASIL
E-mail: maurobio@gmail.com
Web: http://studio.infobio.net
Linux Registered User #473524 * Ubuntu User #22717
"Life is complex. It consists of real and imaginary parts."

Mike Driscoll wrote:

Robert,

a simple cxFreeze of a wx "hello world" is about 15MB / 6MB compressed - a big app not much bigger :-). With UPX a little better.

   1724416 gdiplus.dll (perhaps removable)
    782946 main.exe
    655872 MSVCR90.dll
   2134016 python26.dll
     11776 select.pyd
    966144 wx._controls_.pyd
    976896 wx._core_.pyd
    743424 wx._gdi_.pyd
    675328 wx._misc_.pyd
    669696 wx._windows_.pyd
    122368 wxbase28uh_net_vc.dll
   1305088 wxbase28uh_vc.dll
    729600 wxmsw28uh_adv_vc.dll
   3165696 wxmsw28uh_core_vc.dll
    479744 wxmsw28uh_html_vc.dll

guess py2exe is not significantly less ?

I haven't used that script yet, but py2exe (through GUI2Exe) must do a better job as I made a simple program with 245 lines and when I compiled it, I ended up with 12 files or approx. 2.46 MB. I probably need to add at least one MS related dll which would bump the size up to 3+ MB, but that's still a lot less than what you ended up with.

If you like you could post the code you're using and I can run it through GUI2Exe and post my results as well as the flags I set.

in attachment the simple wx hello script.

I tried a simple py2exe script also meanwhile, but not with GUI2Exe.

It came up with pretty the same files, the same ~75 frozen python files and the above DLL's. After telling him "ascii": 1 (to not include lots of encoding stuff by default)

But py2exe didn't put the crucial
MSVCR90.dll and MSVCP90.dll and (questionable gdiplus.dll ?). Just it listed them randomly in a final 'may be' printout amongst many standard OS DLL's without any special warning. cxFreeze seems to be more sensitive there regarding mistakes.
When I add those 3, its also ~6MB with py2.6
Just UPX could do some impact of ~20%

Really interested about your 2.46MB - even without those 3 DLL's it would be significantly less than 4.5MB compressed (non-UPX) here.

Just with python2.3, which is a half size DLL and only requiring standard msvcrt's, I see so far a significant impact. But requiring effort: unfortunately they stopped the wx binaries for that.

Robert

hello.py (687 Bytes)

Robert wrote:

Mike Driscoll wrote:

Robert,

a simple cxFreeze of a wx "hello world" is about 15MB / 6MB compressed - a big app not much bigger :-). With UPX a little better.

   1724416 gdiplus.dll (perhaps removable)
    782946 main.exe
    655872 MSVCR90.dll
   2134016 python26.dll
     11776 select.pyd
    966144 wx._controls_.pyd
    976896 wx._core_.pyd
    743424 wx._gdi_.pyd
    675328 wx._misc_.pyd
    669696 wx._windows_.pyd
    122368 wxbase28uh_net_vc.dll
   1305088 wxbase28uh_vc.dll
    729600 wxmsw28uh_adv_vc.dll
   3165696 wxmsw28uh_core_vc.dll
    479744 wxmsw28uh_html_vc.dll

guess py2exe is not significantly less ?

I haven't used that script yet, but py2exe (through GUI2Exe) must do a better job as I made a simple program with 245 lines and when I compiled it, I ended up with 12 files or approx. 2.46 MB. I probably need to add at least one MS related dll which would bump the size up to 3+ MB, but that's still a lot less than what you ended up with.

If you like you could post the code you're using and I can run it through GUI2Exe and post my results as well as the flags I set.

in attachment the simple wx hello script.

I tried a simple py2exe script also meanwhile, but not with GUI2Exe.

It came up with pretty the same files, the same ~75 frozen python files and the above DLL's. After telling him "ascii": 1 (to not include lots of encoding stuff by default)

But py2exe didn't put the crucial
MSVCR90.dll and MSVCP90.dll and (questionable gdiplus.dll ?). Just it listed them randomly in a final 'may be' printout amongst many standard OS DLL's without any special warning. cxFreeze seems to be more sensitive there regarding mistakes.
When I add those 3, its also ~6MB with py2.6
Just UPX could do some impact of ~20%

Really interested about your 2.46MB - even without those 3 DLL's it would be significantly less than 4.5MB compressed (non-UPX) here.

Just with python2.3, which is a half size DLL and only requiring standard msvcrt's, I see so far a significant impact. But requiring effort: unfortunately they stopped the wx binaries for that.

Robert

Hmmm....I end up with a 12.7 MB set of 16 files when I run it through GUI2Exe with Compressed and Optimize set to 2 and Bundle Files set to 3. It does not include the dll files you mentioned above though.

I went back and looked at my file that was generating that super small file and it turns out that that wasn't a wxPython project. Talk about me being STUPID! Sorry about that...

- Mike

Mike Driscoll wrote:

Robert wrote:

Mike Driscoll wrote:

Robert,

a simple cxFreeze of a wx "hello world" is about 15MB / 6MB compressed - a big app not much bigger :-). With UPX a little better.

   1724416 gdiplus.dll (perhaps removable)
    782946 main.exe
    655872 MSVCR90.dll
   2134016 python26.dll
     11776 select.pyd
    966144 wx._controls_.pyd
    976896 wx._core_.pyd
    743424 wx._gdi_.pyd
    675328 wx._misc_.pyd
    669696 wx._windows_.pyd
    122368 wxbase28uh_net_vc.dll
   1305088 wxbase28uh_vc.dll
    729600 wxmsw28uh_adv_vc.dll
   3165696 wxmsw28uh_core_vc.dll
    479744 wxmsw28uh_html_vc.dll

guess py2exe is not significantly less ?

I haven't used that script yet, but py2exe (through GUI2Exe) must do a better job as I made a simple program with 245 lines and when I compiled it, I ended up with 12 files or approx. 2.46 MB. I probably need to add at least one MS related dll which would bump the size up to 3+ MB, but that's still a lot less than what you ended up with.

If you like you could post the code you're using and I can run it through GUI2Exe and post my results as well as the flags I set.

in attachment the simple wx hello script.

I tried a simple py2exe script also meanwhile, but not with GUI2Exe.

It came up with pretty the same files, the same ~75 frozen python files and the above DLL's. After telling him "ascii": 1 (to not include lots of encoding stuff by default)

But py2exe didn't put the crucial
MSVCR90.dll and MSVCP90.dll and (questionable gdiplus.dll ?). Just it listed them randomly in a final 'may be' printout amongst many standard OS DLL's without any special warning. cxFreeze seems to be more sensitive there regarding mistakes.
When I add those 3, its also ~6MB with py2.6
Just UPX could do some impact of ~20%

Really interested about your 2.46MB - even without those 3 DLL's it would be significantly less than 4.5MB compressed (non-UPX) here.

Just with python2.3, which is a half size DLL and only requiring standard msvcrt's, I see so far a significant impact. But requiring effort: unfortunately they stopped the wx binaries for that.

Robert

Hmmm....I end up with a 12.7 MB set of 16 files when I run it through GUI2Exe with Compressed and Optimize set to 2 and Bundle Files set to 3. It does not include the dll files you mentioned above though.

I went back and looked at my file that was generating that super small file and it turns out that that wasn't a wxPython project. Talk about me being STUPID! Sorry about that...

- Mike
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

What I did is go through all of the files in the dist/ folder from GUI2exe and manually exclude any listed there that I'm not using, then re-compile to test that exluding the files didn't break my program. Sometimes, one module may rely on another Python module, so it can lead to errors that can be annoying to track down. Just start by looking at the dist/ files in Detail view, order them by size and start to exclude the biggest one first. Also, you may wish to exclude some DLLs you find there, or in your Python folder that you don't use (:\Python2[y]\DLLs)

ImageShack - Best place for all of your image hosting and image sharing needs shows some of the stuff I leave out, gives me around 4.5MB after UPX compression which is pretty good IMO

Saying that though, I don't know why it's so big compared to some programs, (it's a drawing program), for example Paint.NET is 1.6mb which I'm guessing is because it's re-using all the GUI stuff in Windows, but shouldn't wx be doing the same? I know it has to sit on top of Python creating an additional layer, so to speak

Robert,

Robert wrote:
...

in attachment the simple wx hello script.

I tried a simple py2exe script also meanwhile, but not with GUI2Exe.

It came up with pretty the same files, the same ~75 frozen python files and the above DLL's. After telling him "ascii": 1 (to not include lots of encoding stuff by default)

But py2exe didn't put the crucial
MSVCR90.dll and MSVCP90.dll and (questionable gdiplus.dll ?). Just it listed them randomly in a final 'may be' printout amongst many standard OS DLL's without any special warning. cxFreeze seems to be more sensitive there regarding mistakes.

I don't think including or just telling you about it is a big deal. To deploy an application you should/will need to create an installer and it should be the job of the installer to figure out what needs to be installed on which particular OS.

E.g. cxFreeze includes the msvcr dll's but not the corresponding manifest, so your app will not run on all the different MS OS's.

There has been a bit of traffic on this subject, especially in relation with Py2.6 but the same is really true with Py2.5 (just different dll's etc).

You might want to look at the wiki pages I started (will add a cxFreeze page based on Anthony Tuininga comments/suggestions in a recent thread - hoped to get to it this week but that will not happen).

http://wiki.wxpython.org/Deployment

When I add those 3, its also ~6MB with py2.6
Just UPX could do some impact of ~20%

The sample shown on the above wiki page ends up being a 4.7MB using InnoSetup on my Vista machine.

Really interested about your 2.46MB - even without those 3 DLL's it would be significantly less than 4.5MB compressed (non-UPX) here.

Just with python2.3, which is a half size DLL and only requiring standard msvcrt's, I see so far a significant impact. But requiring effort: unfortunately they stopped the wx binaries for that.

Is 2 MB+/- a real big issue for you? I can see this in embedded or small hand held type systems, in which case maybe Python/wxPython is not the right dev platform.

My app with Py2.5 and wxPython 2.8, including db, images etc etc is a 30MB installer and I do not think that it is a very big application yet and I do not recall having had a user complain about it, even so some of my competitors have apps with less then 10MB installers.

Werner

Steven Sproat wrote:

Mike Driscoll wrote:

Robert wrote:

Mike Driscoll wrote:

Robert,

a simple cxFreeze of a wx "hello world" is about 15MB / 6MB compressed - a big app not much bigger :-). With UPX a little better.

   1724416 gdiplus.dll (perhaps removable)
    782946 main.exe
    655872 MSVCR90.dll
   2134016 python26.dll
     11776 select.pyd
    966144 wx._controls_.pyd
    976896 wx._core_.pyd
    743424 wx._gdi_.pyd
    675328 wx._misc_.pyd
    669696 wx._windows_.pyd
    122368 wxbase28uh_net_vc.dll
   1305088 wxbase28uh_vc.dll
    729600 wxmsw28uh_adv_vc.dll
   3165696 wxmsw28uh_core_vc.dll
    479744 wxmsw28uh_html_vc.dll

guess py2exe is not significantly less ?

I haven't used that script yet, but py2exe (through GUI2Exe) must do a better job as I made a simple program with 245 lines and when I compiled it, I ended up with 12 files or approx. 2.46 MB. I probably need to add at least one MS related dll which would bump the size up to 3+ MB, but that's still a lot less than what you ended up with.

If you like you could post the code you're using and I can run it through GUI2Exe and post my results as well as the flags I set.

in attachment the simple wx hello script.

I tried a simple py2exe script also meanwhile, but not with GUI2Exe.

It came up with pretty the same files, the same ~75 frozen python files and the above DLL's. After telling him "ascii": 1 (to not include lots of encoding stuff by default)

But py2exe didn't put the crucial
MSVCR90.dll and MSVCP90.dll and (questionable gdiplus.dll ?). Just it listed them randomly in a final 'may be' printout amongst many standard OS DLL's without any special warning. cxFreeze seems to be more sensitive there regarding mistakes.
When I add those 3, its also ~6MB with py2.6
Just UPX could do some impact of ~20%

Really interested about your 2.46MB - even without those 3 DLL's it would be significantly less than 4.5MB compressed (non-UPX) here.

Just with python2.3, which is a half size DLL and only requiring standard msvcrt's, I see so far a significant impact. But requiring effort: unfortunately they stopped the wx binaries for that.

Robert

Hmmm....I end up with a 12.7 MB set of 16 files when I run it through GUI2Exe with Compressed and Optimize set to 2 and Bundle Files set to 3. It does not include the dll files you mentioned above though.

I went back and looked at my file that was generating that super small file and it turns out that that wasn't a wxPython project. Talk about me being STUPID! Sorry about that...

- Mike
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

What I did is go through all of the files in the dist/ folder from GUI2exe and manually exclude any listed there that I'm not using, then re-compile to test that exluding the files didn't break my program. Sometimes, one module may rely on another Python module, so it can lead to errors that can be annoying to track down. Just start by looking at the dist/ files in Detail view, order them by size and start to exclude the biggest one first. Also, you may wish to exclude some DLLs you find there, or in your Python folder that you don't use (:\Python2[y]\DLLs)

That's an interesting idea. I currently don't care that much since all my programs right now are for internal use at the company I work for and most machines have plenty of space. But it is something I watch out for anyway...

ImageShack - Best place for all of your image hosting and image sharing needs shows some of the stuff I leave out, gives me around 4.5MB after UPX compression which is pretty good IMO

Saying that though, I don't know why it's so big compared to some programs, (it's a drawing program), for example Paint.NET is 1.6mb which I'm guessing is because it's re-using all the GUI stuff in Windows, but shouldn't wx be doing the same? I know it has to sit on top of Python creating an additional layer, so to speak

Paint.NET can be small because it relies on .NET being installed. This is actually kind of naive as we do not install .NET on all our machines. This used to be due to space constraints and the added burden of keeping just that much more up-to-date and secure. As an aside, note that .NET versions do not conflict, but sometimes the .NET updates or hotfixes can break things. Weird!

If you were to factor in the size of .NET, the size required to run Paint.NET goes up considerably.

Anyway, that's probably splitting hairs.

- Mike

Steven Sproat wrote:

Saying that though, I don't know why it's so big compared to some programs, (it's a drawing program), for example Paint.NET is 1.6mb which I'm guessing is because it's re-using all the GUI stuff in Windows, but shouldn't wx be doing the same? I know it has to sit on top of Python creating an additional layer, so to speak

IIUC to make a fair comparison with a .NET app you should only measure the size of the .pyc files. Everything else would be equivalent to the CLR and .Net frameworks which are already installed.

···

--
Robin Dunn
Software Craftsman

Hi,

Steven Sproat wrote:

What I did is go through all of the files in the dist/ folder from GUI2exe
and manually exclude any listed there that I'm not using, then re-compile to
test that exluding the files didn't break my program. Sometimes, one module
may rely on another Python module, so it can lead to errors that can be
annoying to track down. Just start by looking at the dist/ files in Detail
view, order them by size and start to exclude the biggest one first. Also,
you may wish to exclude some DLLs you find there, or in your Python folder
that you don't use (:\Python2[y]\DLLs)

That's an interesting idea. I currently don't care that much since all my
programs right now are for internal use at the company I work for and most
machines have plenty of space. But it is something I watch out for anyway...

It is a very interesting idea, I'll add this as an option to GUI2Exe:
something like the Explorer window but with the ability to let you
choose what to exclude, either dlls or Python modules.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Wed, May 27, 2009 at 7:43 PM, Mike Driscoll wrote:

Andrea Gavana wrote:

It is a very interesting idea, I'll add this as an option to GUI2Exe:
something like the Explorer window but with the ability to let you
choose what to exclude, either dlls or Python modules.

Good idea -- my significant py2exe/py2app scripts have a stanza at the end that deletes stuff I now I don't want.

I wonder if the approach all? of the python bundlers use -- parsing the source code -- is the best options. I find that a lot of stuff I need doesn't get included, and a lot of stuff I don't need does get included.

I wonder if you could use a system that ran a test script, then included everything that got imported in your bundle. Would it really be as easy as dumping sys.modules?

It would require a comprehensive test script, but we all have those, right?

If you wanted to be really robust, you could include the superset of what got imported and what the source code analysis included.

So many projects, so little time....

-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@noaa.gov

Steven Sproat wrote:

Saying that though, I don't know why it's so big compared to some programs,

Well, you've got:

all of Python
all of wxWidgets
all of the wrapper code

That's a lot! On OS-X, I distribute Universal binaries (PPC and Intel), then it really gets big!

In theory, wxWidgets could be be broken out into more separate libs, and the wxPython wrappers could follow that break out, so you wouldn't have to include any of the larger widgets that you don't use.

In practice, it would be a pain to do that, and disk space, and even network bandwidth is pretty cheap these days, so no one has done it.

I recently spent some pain trimming a few MBs off an app, then we ended up bundling it with 100MB of data anyway -- oh well!

-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@noaa.gov

Chris, you have a future in stand-up comedy. You could be the next Seinfeld.

···

On Wed, May 27, 2009 at 6:49 PM, Christopher Barker <Chris.Barker@noaa.gov> wrote:

It would require a comprehensive test script, but we all have those, right?

--
Best Regards,
Michael Moriarity

Christopher Barker wrote:

Steven Sproat wrote:

Saying that though, I don't know why it's so big compared to some programs,

Well, you've got:

all of Python
all of wxWidgets
all of the wrapper code

That's a lot! On OS-X, I distribute Universal binaries (PPC and Intel), then it really gets big!

In theory, wxWidgets could be be broken out into more separate libs, and the wxPython wrappers could follow that break out, so you wouldn't have to include any of the larger widgets that you don't use.

In practice, it would be a pain to do that, and disk space, and even network bandwidth is pretty cheap these days, so no one has done it.

I recently spent some pain trimming a few MBs off an app, then we ended up bundling it with 100MB of data anyway -- oh well!

-Chris

Yeah, the size doesn't bother me, since I initally started off with a 16MB application (just annoying to upload to many sites when I was updating often), so to trim to 4mb is good :slight_smile:
I just thought wx wouldn't add much on top of Python's ~2.5mb, but it's all good, I grew tired of trimming every possible dll/python module down