pythonpipvaticle-typedbgrpcio

Issues installing python typedb-client on macOs m1 architecture


When I try to install the python typedb-client using pip, I get several errors concerning grpcio:

Building wheels for collected packages: grpcio
  Building wheel for grpcio (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [21870 lines of output]
      ASM Builds for BoringSSL currently not supported on: macosx-11.1-arm64

as well as many lines of:

...
distutils.errors.CompileError: command '/usr/bin/gcc' failed with exit code 1
...

This happens both on global installation and in conda environments...


Solution

  • After searching for grpcio installation issues on the M1 architecture, the solution for me was to prepend the following to the pip command:

    
    export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 pip install typedb-client==2.9.0
    

    in some cases, should you see ssl errors, you can extend that command to:

    CFLAGS="-I /opt/homebrew/opt/openssl/include" LDFLAGS="-L /opt/homebrew/opt/openssl/lib" GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 pip install typedb-client==2.9.0
    

    assuming that you have openssl install via homebrew. This tells pip where to look for appropriate headers and code to build the grpcio pip package.