Hi,
I have a kivy windows desktop application which makes use of kivyMD, opencv and numpy (as major modules in terms of size).
The application (ngassist.exe) is built using PyInstaller and generated in a distributable installer package (.exe) using InnoSetup.
When started ngassist takes around 95MB of memory which seems pretty much taking the relatively small functionality into account. Looking at the distribution set produced with PyInstaller the following packages consume quite some resources (see full list below):
numpy: 31 MB
OpenCV: 10 MB
Microsoft stuff: 9 MB
Kivy: 6 MB
I tried to keep the imports as concise as possible by only using the named classes according to: from a import x,y,z
Only for numpy, ctypes, win32con, kivy and kivymd I used the full import.
In PyInstaller my excludes are: excludes = ['Tkinter', '_tkinter', 'twisted', 'pygments', 'gen_pkglist', 'docutils']
and I exclude anything from the Windows system dir using:
a.binaries = [x for x in a.binaries if not os.path.dirname(x[1]).startswith("C:\\Windows\\system32")]
Is it possible to reduce the size of this app further, for example by excluding more modules in PyInstaller? However, I do not know what further can be excluded. Also I tried to use tinynumpy instead of numpy but that conflicts with OpenCV as this requires numpy.
Thanks for sharing your expertise in advance,
Wim
Full list of PyInstaller result:
_bsddb.pyd |
1.106.432 |
|
_ctypes.pyd |
91.648 |
|
_elementtree.pyd |
143.360 |
|
_hashlib.pyd |
1.016.832 |
|
_multiprocessing.pyd |
27.648 |
|
_socket.pyd |
46.592 |
|
_ssl.pyd |
1.411.072 |
|
_testcapi.pyd |
41.984 |
|
_win32sysloader.pyd |
8.192 |
|
bz2.pyd |
71.168 |
|
cv2.pyd |
10.836.480 |
|
glew32.dll |
656.441 |
|
kivy._clock.pyd |
179.200 |
|
kivy._event.pyd |
231.424 |
|
kivy.core.audio.audio_sdl2.pyd |
132.608 |
|
kivy.core.clipboard._clipboard_sdl2.pyd |
22.016 |
|
kivy.core.image._img_sdl2.pyd |
57.344 |
|
kivy.core.text._text_sdl2.pyd |
71.168 |
|
kivy.core.text.text_layout.pyd |
135.168 |
|
kivy.core.window._window_sdl2.pyd |
108.544 |
|
kivy.graphics.buffer.pyd |
29.696 |
|
kivy.graphics.cgl.pyd |
115.200 |
|
kivy.graphics.cgl_backend.cgl_debug.pyd |
220.160 |
|
kivy.graphics.cgl_backend.cgl_gl.pyd |
31.232 |
|
kivy.graphics.cgl_backend.cgl_glew.pyd |
40.448 |
|
kivy.graphics.cgl_backend.cgl_mock.pyd |
23.040 |
|
kivy.graphics.cgl_backend.cgl_sdl2.pyd |
26.112 |
|
kivy.graphics.compiler.pyd |
56.320 |
|
kivy.graphics.context.pyd |
159.744 |
|
kivy.graphics.context_instructions.pyd |
373.248 |
|
kivy.graphics.fbo.pyd |
134.144 |
|
kivy.graphics.gl_instructions.pyd |
91.136 |
|
kivy.graphics.instructions.pyd |
173.568 |
|
kivy.graphics.opengl.pyd |
414.720 |
|
kivy.graphics.opengl_utils.pyd |
81.920 |
|
kivy.graphics.scissor_instructions.pyd |
128.000 |
|
kivy.graphics.shader.pyd |
186.880 |
|
kivy.graphics.stencil_instructions.pyd |
111.616 |
|
kivy.graphics.svg.pyd |
555.008 |
|
kivy.graphics.tesselator.pyd |
186.880 |
|
kivy.graphics.texture.pyd |
398.848 |
|
kivy.graphics.transformation.pyd |
126.976 |
|
kivy.graphics.vbo.pyd |
80.896 |
|
kivy.graphics.vertex.pyd |
38.912 |
|
kivy.graphics.vertex_instructions.pyd |
643.584 |
|
kivy.lib.gstplayer._gstplayer.pyd |
70.656 |
|
kivy.properties.pyd |
477.696 |
|
kivy.weakproxy.pyd |
133.632 |
6.047.744 |
libbz2-1.dll |
76.571 |
|
libFLAC-8.dll |
387.072 |
|
libfreetype-6.dll |
2.644.976 |
|
libgcc_s_dw2-1.dll |
119.988 |
|
libifcoremd.dll |
1.172.632 |
|
libifportmd.dll |
273.560 |
|
libiomp5md.dll |
1.048.216 |
|
libiompstubs5md.dll |
81.048 |
|
libjpeg-9.dll |
224.256 |
|
libmmd.dll |
4.130.968 |
|
libmodplug-1.dll |
380.416 |
|
libmpg123-0.dll |
339.456 |
|
libogg-0.dll |
47.104 |
|
libpng16-16.dll |
202.752 |
|
libtiff-5.dll |
447.488 |
|
libvorbis-0.dll |
196.608 |
|
libvorbisfile-3.dll |
63.488 |
|
libwebp-7.dll |
416.256 |
|
libwinpthread-1.dll |
65.181 |
|
LICENSE.FLAC.txt |
1.649 |
|
LICENSE.freetype.txt |
7.033 |
|
LICENSE.jpeg.txt |
3.148 |
|
LICENSE.modplug.txt |
59 |
|
LICENSE.mpg123.txt |
41.490 |
|
LICENSE.ogg-vorbis.txt |
1.625 |
|
LICENSE.png.txt |
5.245 |
|
LICENSE.tiff.txt |
1.294 |
|
LICENSE.webp.txt |
1.653 |
|
LICENSE.zlib.txt |
1.689 |
|
mfc90.dll |
3.766.600 |
|
mfc90u.dll |
3.781.960 |
|
mfcm90.dll |
59.904 |
|
mfcm90u.dll |
59.904 |
|
Microsoft.VC90.CRT.manifest |
1.050 |
|
Microsoft.VC90.MFC.manifest |
1.139 |
|
msvcm90.dll |
225.280 |
|
msvcp90.dll |
570.512 |
|
msvcr90.dll |
653.968 |
9.120.317 |
ngassist.exe |
6.528.928 |
|
ngassist.exe.manifest |
1.013 |
|
numpy.core.multiarray.pyd |
6.794.240 |
|
numpy.core.umath.pyd |
681.472 |
|
numpy.fft.fftpack_lite.pyd |
66.048 |
|
numpy.linalg._umath_linalg.pyd |
18.505.728 |
|
numpy.linalg.lapack_lite.pyd |
4.399.104 |
|
numpy.random.mtrand.pyd |
657.920 |
31.104.512 |
PIL._imaging.pyd |
1.091.072 |
|
PIL._imagingft.pyd |
475.648 |
|
PIL._imagingtk.pyd |
9.216 |
|
PIL._webp.pyd |
424.448 |
|
psutil._psutil_windows.pyd |
50.176 |
|
pyexpat.pyd |
144.384 |
|
python27.dll |
2.646.016 |
|
pythoncom27.dll |
397.824 |
|
pywintypes27.dll |
110.592 |
|
SDL2.dll |
1.042.944 |
|
SDL2_image.dll |
138.752 |
|
SDL2_mixer.dll |
139.264 |
|
SDL2_ttf.dll |
168.692 |
|
sdl2-config |
1.377 |
|
select.pyd |
10.240 |
|
svml_dispmd.dll |
10.497.688 |
|
tbb.dll |
248.832 |
|
unicodedata.pyd |
687.104 |
|
win32api.pyd |
100.864 |
|
win32com.shell.shell.pyd |
381.952 |
|
win32file.pyd |
119.808 |
|
win32gui.pyd |
167.936 |
|
win32pdh.pyd |
25.600 |
|
win32pipe.pyd |
24.064 |
|
win32print.pyd |
52.736 |
|
win32process.pyd |
36.864 |
|
win32trace.pyd |
15.872 |
|
win32ui.pyd |
779.776 |
|
win32wnet.pyd |
25.088 |
|
zlib1.dll |
128.000 |
|