Skip to content

The size of Python executable files has significantly increased starting from the 20250517 build #941

Open

Description

@vudaoanhtuan

I've noticed that, starting with the 20250517 build, the file size of the python executable file is significantly larger than in builds from 20250409 and earlier.

For example:

  • The python3.9 file from cpython-3.9.22+20250409-x86_64-unknown-linux-gnu-install_only.tar.gz is only 21KB
  • The python3.9 file from cpython-3.9.22+20250517-x86_64-unknown-linux-gnu-install_only.tar.gz is about 47MB

I'm wondering why the size has changed so much. Can we reduce the file size as before, because it affects the size of our Docker images?

Activity

  1. zanieb commented on Jan 4, 2026

    @zanieb
    Member

    The change is from #592 which statically links libpython into the python executable. It makes a dramatic difference in performance (10-25% faster).

  2. jjhelmus commented on Jan 5, 2026

    @jjhelmus
    Contributor

    With the change to statically linking libpython into python, the dynamic libraries are typically not needed at runtime. If you are looking to save space these can be safely removed in a majority of use cases. For example using rm lib/libpython*.

    These libraries are included in the distributions for user who want to embed python, some build systems that need libpython, and a few other edge cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions