Making app package smaller

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Making app package smaller

Elliott Balsley
Even for a very simple python code, PyInstaller adds a lot of extra files.  Is there a recommended way to remove some of this to make the app smaller?  For example, a Python code with just one line:

print('Hello world.')

The app package is 13.5 MB on macOS, or 5.9MB in one-file mode.  Some of the largest files in the package are:
libcrypto.1.1.dylib 2.8M
unicodedata.cpython-37m-darwin.so 1.1M
libssl.1.1.dylib 556K
libncursesw.5.dylib 433K

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/a5e2d8ea-dee1-4319-858b-c8651de8057en%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Making app package smaller

Pax Williams
Have you tried using UPX?

https://pyinstaller.readthedocs.io/en/stable/usage.html#using-upx

On Tuesday, December 29, 2020 at 12:56:09 AM UTC-8 [hidden email] wrote:
Even for a very simple python code, PyInstaller adds a lot of extra files.  Is there a recommended way to remove some of this to make the app smaller?  For example, a Python code with just one line:

print('Hello world.')

The app package is 13.5 MB on macOS, or 5.9MB in one-file mode.  Some of the largest files in the package are:
libcrypto.1.1.dylib 2.8M
libssl.1.1.dylib 556K
libncursesw.5.dylib 433K

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/ca8c5c36-9acb-40c8-b2e4-2afddb11538en%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Making app package smaller

Elliott Balsley
Thanks for the tip, I had not tried that.  I installed UPX (version 3.96 from home-brew) and it saved me a whopping 0.0001 percent.  The single file binary for "hello world" went from 5870240 bytes to 5870233 bytes.
On Saturday, March 6, 2021 at 8:13:33 AM UTC-8 Pax Williams wrote:
Have you tried using UPX?

On Tuesday, December 29, 2020 at 12:56:09 AM UTC-8 [hidden email] wrote:
Even for a very simple python code, PyInstaller adds a lot of extra files.  Is there a recommended way to remove some of this to make the app smaller?  For example, a Python code with just one line:

print('Hello world.')

The app package is 13.5 MB on macOS, or 5.9MB in one-file mode.  Some of the largest files in the package are:
libcrypto.1.1.dylib 2.8M
libssl.1.1.dylib 556K
libncursesw.5.dylib 433K

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/d7e9c2de-749b-4667-8fd6-8f54f73044ean%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Making app package smaller

bwoodsend

UPX is great for onedir builds but both UPX and onefile use zlib compression so using both simultaneously won’t accomplish anything. The OpenSSL stuff (libcrypto and libssl) are optional components of Python so if you were really determined you could compile Python itself from source with those components disabled then run PyInstaller but it’ll be a lot of work.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/6701fa93-1c4f-4769-8a21-ee7accf4e2b7n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Making app package smaller

Elliott Balsley

Okay, good idea.  That does sound like a lot of work though, probably not worth it for me.  I'm just curious.

For what it's worth, UPX makes no difference on a onedir build either.  See below, it's exactly the same bytes.  Is there some way to see if UPX is actually working?

 % echo "print('Hello world.')" > helloworld.py
 % pyinstaller --noupx helloworld.py

 % du -d 1 dist       
26528 dist/helloworld
26528 dist

 % rm -rf dist build       
 % pyinstaller helloworld.py
 % du -d 1 dist                     
26528 dist/helloworld
26528 dist
On Tuesday, April 6, 2021 at 8:37:04 AM UTC-7 bwoodsend wrote:

UPX is great for onedir builds but both UPX and onefile use zlib compression so using both simultaneously won’t accomplish anything. The OpenSSL stuff (libcrypto and libssl) are optional components of Python so if you were really determined you could compile Python itself from source with those components disabled then run PyInstaller but it’ll be a lot of work.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/f714229e-207b-47e5-bdc6-e4aa47bf02bfn%40googlegroups.com.