This forum has been archived. Please start a new discussion on GitHub.

Python import error on Macbook M1?

I suffer an error when using python3 to import zeroc-ice on Macbook M1(Monterey 12.5.1):

ImportError: dlopen(/Users/username/Library/Python/3.8/lib/python/site-packages/, 0x0002):
tried: '/Users/username/Library/Python/3.8/lib/python/site-packages/'
(mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

The zeroc-ice is installed by pip (python3 -m pip install zeroc-ice),
looks like it installed files for x86_64 architecture, but M1 cpu isn't, then import error,

Have anyone suffered this issue before?
May I consult how to solve it?



  • xdm
    xdm La Coruña, Spain


    How did you install Ice for Python?

  • xdm
    xdm La Coruña, Spain

    For pip you can try setting export ARCHFLAGS="-arch arm64" and then re-install the package.

  • Hi Jose,
    The export ARCHFLAGS="-arch arm64 is working,

    Thank you very much~