Azure Function - Failed to start a new language worker for runtime: Python (M1 Mac incompatible architecture (have 'x86_64', need 'arm64e'))

Viewed 843

I am trying to Build http triggered python function app. I just initialized it using terminal commands. I have not modified anything in base template. I am trying to run it on localhost but when I use 'func start host' I get this ImportError:

ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.3971/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so, 0x0002): tried: '/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.3971/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/cygrpc.cpython-37m-darwin.so' (no such file), '/usr/lib/cygrpc.cpython-37m-darwin.so' (no such file)

even after this error it seems function is hosted on localhost and I get localhost link to trigger api call, but when I try to call via api the host api it doesn't respond and just crashes with following errors.

error log

2 Answers

This is an existing issue. The workaround could be using the python interpreter from a conda environment

  1. Create a conda environment with supported python version

  2. Go to the root directory of the project

  3. Remove .venv folder

  4. Activate the newly created conda environment

  5. Create new virtual environment using python -m venv .venv/

OR

you could manually select python interpreter while creating the azure function Image

Related