Typical File Sizes For Pyinstaller
You use pyinstaller
to convert your python program into a self-contained directory or a single file executable that you can distribute to users.
The size of the self-contained directory or single file executable depends on what modules your program imports. Here are some common modules I imported and the resultant size.
- hello world program (imports nothing, so you are just using the python interpretter)
- 14.7 mb if outputting a directory
- 6.7 mb if using –onefile option (–onefile option puts everything inside a single
.exe
file)
- importing the following modules: argparse, os, re, subprocess, pathlib, and shutil
- 14.7 mb (directory)
- 6.7 mb if using –onefile option
- importing the following modules: tkinter
- 22.3 mb (directory)
- 9.6 mb if using –onefile option
- importing the following moduels: tkinter, argparse, os, re, subprocess, pathlib, and shutil
- 22.3 mb (directory)
- 9.6 mb if using –onefile option
- importing the following modules: numpy
- 56.5 mb (directory)
- 20 mb if using –onefile option
- importing the following modules: matplotlib (which internally imports numpy)
- 81.6 mb (directory)
- 33 mb if using –onefile option
- importing the following modules: numpy, tkinter
- 64.1 mb (directory)
- 32 mb if using –onefile option
Conclusions:
- packaging the python interpretter alone is about 14.7 mb if outputing a folder and 6.7 mb if outputting a single file (a single exe file)
- importing a few standard library modules adds nothing on top of the base interpretter
- importing tkinter adds about 7 mb to a folder or 3 mb to a single file executable
- numpy adds about 40 mb to a folder and 13 mb to a single file executable
- matplotlib adds 65 mb to a folder and 25 mb to a single file executable, but a lot of this is due to the fact that matplotlib will import numpy
- the single file output is less than half of the directory output