astral-sh / astral-sh/python-build-standalone
Questions about libpython size, specifically on Linux x86_64
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 314
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 27
Description
Several possibly-related questions. Note that I'm not necessarily saying anything is "wrong" here, I'm just trying to understand the differences.
So I've noticed two things about libpython.3.xx.so.1.0, working on x86_64-unknown-linux-gnu:
1. Python 3.12's libpython is 4x the size of Python 3.11: 212MB vs. 58MB. If you `strip` both of them, the size difference largely vanishes; Python 3.12 is 25.3MB, where Python 3.11 is 24.4MB.
2. python-build-standalone's _stripped_ libpython is still something like 4x larger than the libpython that comes with Fedora 40, which is 6.1MB for Python 3.12 and 4.9MB for Python 3.11.
This is particularly noticeable when developing standalone binaries with PyInstaller. I've hacked PyInstaller locally to work with python-build-standalone, but the resulting binaries are nearly 3x the size compared to building with Fedora's python even if I build with the stripped libpython, which is kind of rough.
Contributor guide
Assessment
This issue has not been assessed yet.