[Python] Reducing number of identical BLAS DLLs in pyinstaller generated distributable

Discussão em 'Python' iniciado por Stack, Maio 21, 2025.

  1. Stack

    Stack Membro Participativo

    I created an executable with pyinstaller and noticed that even after some size reduction tricks (creating a custom environment, using OpenBLAS instead of MKL) the package comes out quite big. When looking into the _internal directory I found that the same DLL has been copied there four times. I used WinMerge to verify that indeed the files are binary identical.

    dir /Os

    [...]
    08-May-25 12:07 7,280,128 python313.dll
    08-May-25 12:07 27,951,616 liblapack.dll
    08-May-25 12:07 27,951,616 openblas.dll
    08-May-25 12:07 27,951,616 libcblas.dll
    08-May-25 12:07 27,951,616 libblas.dll
    145 File(s) 161,490,356 bytes


    Out of a total of 247MB for the package those libraries make up 106MB.

    How can I avoid having the same copy multiple times? Can I tell pyinstaller? Can I avoid it during python package installation in the environment?

    Creating symbolic links with mklink is not an option on my Windows installation (You do not have sufficient privilege to perform this operation.), so any solution that targets the root cause would be appreciated.

    Continue reading...

Compartilhe esta Página