pythonapple-m1geventpython-poetry

Gevent cant be installed on M1 mac using poetry


I tried to install many dependencies for a virtual environment using poetry. When it gets to gevent (20.9.0) it gets the following

import error:

ImportError: dlopen(/private/var/folders/21/wxg5bdsj1w3f3j_9sl_pktbw0000gn/T/pip-build-env-50mwte36/overlay/lib/python3.8/site-packages/_cffi_backend.cpython-38-darwin.so,
0x0002): tried:
'/private/var/folders/21/wxg5bdsj1w3f3j_9sl_pktbw0000gn/T/pip-build-env-50mwte36/overlay/lib/python3.8/site-packages/_cffi_backend.cpython-38-darwin.so'
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/_cffi_backend.cpython-38-darwin.so' (no such file), '/usr/lib/_cffi_backend.cpython-38-darwin.so' (no such file)

I've tried to use pip3 instead, but still had the same problem.


Solution

  • I've have this problem with other libraries also and this solution worked some times:

    arch -arm64 <poetry or pip> install <lib to istall>
    

    Using arch -arm64 allowed me to install the rigt wheel for the M1 processor