Hi all,
I installed grpcio-tools using the poetry python packager using poetry
add grpcio-tools. I have verified it's the same issue described below
if I use pip directly.
When trying to use grpcio-tools on Python 3.10 - Mac M1, I am running
into this error when generating some Python code:
% poetry run python -m grpc_tools.protoc --python_out=.
--grpc_python_out=. user_sessions.proto
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py",
line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py",
line 86, in _run_code
exec(code, run_globals)
File "/Users/echorand/Library/Caches/pypoetry/virtualenvs/user-sessions-2yjUCcPI-py3.10/lib/python3.10/site-packages/grpc_tools/protoc.py",
line 20, in <module>
from grpc_tools import _protoc_compiler
ImportError: dlopen(/Users/echorand/Library/Caches/pypoetry/virtualenvs/user-sessions-2yjUCcPI-py3.10/lib/python3.10/site-packages/grpc_tools/_
protoc_compiler.cpython-310-darwin.so,
0x0002): tried:
'/Users/echorand/Library/Caches/pypoetry/virtualenvs/user-sessions-2yjUCcPI-py3.10/lib/python3.10/site-packages/grpc_tools/_
protoc_compiler.cpython-310-darwin.so'
(mach-o file, but is an incompatible architecture (have 'x86_64', need
'arm64e')), '/usr/lib/_
protoc_compiler.cpython-310-darwin.so' (no such
file)
I tried this next:
% arch -x86_64 poetry run python -m grpc_tools.protoc --proto_path .
--python_out=. --grpc_python_out=. user_sessions.proto
And that works. So, perhaps an issue with the universal binary wheel
of grpcio-tools I am using and it's non compatibility with arm64?
Thanks,
Amit.