Home Help Center

Python import error on Macbook M1?

akckwangakckwang Member akckOrganization: FIHProject: remote control

Hi,
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/IcePy.cpython-38-darwin.so, 0x0002):
tried: '/Users/username/Library/Python/3.8/lib/python/site-packages/IcePy.cpython-38-darwin.so'
(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?

Thanks~

Best Answer

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Answer ✓

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

Answers

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff

    Hi,

    How did you install Ice for Python?

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Answer ✓

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

  • akckwangakckwang Member akckOrganization: FIHProject: remote control

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

    Thank you very much~

Sign In or Register to comment.