Anatomy of the --onefile vs. --onedir Bundle and the Size Myth
When you pass --onefile to PyInstaller, the build tool does not strip dead code, prune unused shared libraries, or shrink your Python interpreter. Instead, the bootloader appends a compressed archive (typically using zlib or LZMA) containing the exact same set of .pyc bytecode files, .so / .dll shared objects, and data assets that a --onedir build places into a directory tree. If your bundle contains a 600 MB scientific or machine learning stack, --onefile still carries all 600 MB of underlying payload inside that single executable. Any file-size reduction you observe on disk comes from archive compression ratios minus a small bootloader stub, whereas at runtime the uncompressed bytes must be written out anyway—meaning --onefile often inflates temporary storage pressure rather than saving space.
The physical cause of tmpfs failures lies in how a --onefile binary boots.…