Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gRPC installation in macs with arm64e (M1/M2) #71

Closed
praneethchityala opened this issue Jan 24, 2023 · 1 comment
Closed

gRPC installation in macs with arm64e (M1/M2) #71

praneethchityala opened this issue Jan 24, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@praneethchityala
Copy link
Contributor

This error is only specific to macbooks with apple silicon (M1/M2...)

Description

When trying work with mft after installing using "pip install airavata-mft-cli", unable to use mft with conflicts from gRPC libraries incompatible with arm64e architecture.

Steps to Reproduce

Create a python virtual environment by "python3.10 -m venv venv"
Activate the above env "source venv/bin/activate"
Install mft-client with "pip install airavata-mft-cli".
Execute "mft --help" to generate the below error.

Traceback (most recent call last):
  File "/opt/homebrew/bin/mft", line 5, in <module>
    from airavata_mft_cli.main import app
  File "/opt/homebrew/lib/python3.10/site-packages/airavata_mft_cli/main.py", line 2, in <module>
    import airavata_mft_cli.storage
  File "/opt/homebrew/lib/python3.10/site-packages/airavata_mft_cli/storage/__init__.py", line 3, in <module>
    import airavata_mft_cli.storage.s3 as s3
  File "/opt/homebrew/lib/python3.10/site-packages/airavata_mft_cli/storage/s3.py", line 4, in <module>
    from airavata_mft_sdk import mft_client
  File "/opt/homebrew/lib/python3.10/site-packages/airavata_mft_sdk/mft_client.py", line 1, in <module>
    import grpc
  File "/opt/homebrew/lib/python3.10/site-packages/grpc/__init__.py", line 22, in <module>
    from grpc import _compression
  File "/opt/homebrew/lib/python3.10/site-packages/grpc/_compression.py", line 15, in <module>
    from grpc._cython import cygrpc
ImportError: dlopen(/opt/homebrew/lib/python3.10/site-packages/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): tried: '/opt/homebrew/lib/python3.10/site-packages/grpc/_cython/cygrpc.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

Expected Behaviour

It is expected to execute mft commands.

Your Environment

M1 MacBook Pro.

@praneethchityala praneethchityala added the bug Something isn't working label Jan 24, 2023
@praneethchityala
Copy link
Contributor Author

It is causing because of the incompatibility of cpython versions.

Solution:

Before installing airavata-mft-cli, install grpcio and grpcio-tools with the below commands:

"pip install grpcio==1.47.0rc1"
"pip install grpcio-tools==1.47.0rc1"

The above installation will install the grpcio from the source and doesn't break the wheel. Refer to : grpc/grpc#28387

Then install airavata-mft-cli: "pip install airavata-mft-cli"

After above installation deactivate the python venv by "deactivate" and reactivate by "source venv/bin/activate". (this step will make sure the use the libraries from venv we created instead of, if any global grpc already exists.)

Now on you should be able to use mft in this python environment.

This has solved the issue in my MacBook M1 pro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant