[Python] Failed running pyinstaller for universal2 arch. Some dependencies are not compatible

Discussão em 'Python' iniciado por Stack, Março 26, 2025.

  1. Stack

    Stack Membro Participativo

    Pyinstaller can set the target arch when working with .spec files by specifying the target architecture in the .spec file via the target_arch= argument to EXE().

    I want to set it to universal2 to build a macho fat file for running on both Intel and arm64 macOS available architectures.

    However, some of the dependancies are python system .so libraries built for current arch only (in my case it's arm64)

    This leads to the following error when trying to build the executable:

    raise IncompatibleBinaryArchError(f"{display_name} is not a fat binary!")
    PyInstaller.utils.osx.IncompatibleBinaryArchError:
    /opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/_struct.cpython-310-darwin.so is not a fat binary!


    So apparently _struct.cpython-310-darwin.so is built for arm64 only... Is there any way to build a FAT version of my project ?

    where can I get builtin python framework that compiled as FAT ?

    Is there a way to auto-download the right library compiled for the desired arch, upon demand ?

    thanks !

    Continue reading...

Compartilhe esta Página