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

Can't start function host for debugging python function on m1 #2394

Closed
Valansch opened this issue Jan 17, 2021 · 8 comments
Closed

Can't start function host for debugging python function on m1 #2394

Valansch opened this issue Jan 17, 2021 · 8 comments

Comments

@Valansch
Copy link

Whats the issue?
When trying to run:
>func host start
i receive:
ModuleNotFoundError: No module named '_ctypes'

Full error
Found Python version 3.7.9 (python3).

Azure Functions Core Tools
Core Tools Version:       3.0.3233 Commit hash: d1772f733802122a326fa696dd4c086292ec0171
Function Runtime Version: 3.0.15193.0

[2021-01-17T16:33:17.558Z] Exceeded language worker restart retry count for runtime:python. Shutting down and proactively recycling the Functions Host to recover
[2021-01-17T16:33:17.569Z] Traceback (most recent call last):
[2021-01-17T16:33:17.569Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/worker.py", line 84, in <module>
[2021-01-17T16:33:17.569Z]     from azure_functions_worker import main
[2021-01-17T16:33:17.569Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/azure_functions_worker/main.py", line 8, in <module>
[2021-01-17T16:33:17.569Z]     from . import dispatcher
[2021-01-17T16:33:17.569Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/azure_functions_worker/dispatcher.py", line 21, in <module>
[2021-01-17T16:33:17.570Z]     import grpc
[2021-01-17T16:33:17.570Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/__init__.py", line 23, in <module>
[2021-01-17T16:33:17.570Z]     from grpc._cython import cygrpc as _cygrpc
[2021-01-17T16:33:17.570Z] ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so, 2): no suitable image found.  Did find:
[2021-01-17T16:33:17.570Z] 	/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so: mach-o, but wrong architecture
[2021-01-17T16:33:17.570Z] 	/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so: mach-o, but wrong architecture
[2021-01-17T16:33:17.570Z] Traceback (most recent call last):
[2021-01-17T16:33:17.570Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/worker.py", line 84, in <module>
[2021-01-17T16:33:17.570Z]     from azure_functions_worker import main
[2021-01-17T16:33:17.570Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/azure_functions_worker/main.py", line 8, in <module>
[2021-01-17T16:33:17.570Z]     from . import dispatcher
[2021-01-17T16:33:17.570Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/azure_functions_worker/dispatcher.py", line 21, in <module>
[2021-01-17T16:33:17.570Z]     import grpc
[2021-01-17T16:33:17.570Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/__init__.py", line 23, in <module>
[2021-01-17T16:33:17.570Z]     from grpc._cython import cygrpc as _cygrpc
[2021-01-17T16:33:17.570Z] ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so, 2): no suitable image found.  Did find:
[2021-01-17T16:33:17.571Z] 	/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so: mach-o, but wrong architecture
[2021-01-17T16:33:17.571Z] 	/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so: mach-o, but wrong architecture
[2021-01-17T16:33:17.571Z] Traceback (most recent call last):
[2021-01-17T16:33:17.571Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/worker.py", line 84, in <module>
[2021-01-17T16:33:17.571Z]     from azure_functions_worker import main
[2021-01-17T16:33:17.571Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/azure_functions_worker/main.py", line 8, in <module>
[2021-01-17T16:33:17.571Z]     from . import dispatcher
[2021-01-17T16:33:17.571Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/azure_functions_worker/dispatcher.py", line 21, in <module>
[2021-01-17T16:33:17.571Z]     import grpc
[2021-01-17T16:33:17.571Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/__init__.py", line 23, in <module>
[2021-01-17T16:33:17.571Z]     from grpc._cython import cygrpc as _cygrpc
[2021-01-17T16:33:17.571Z] ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so, 2): no suitable image found.  Did find:
[2021-01-17T16:33:17.571Z] 	/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so: mach-o, but wrong architecture
[2021-01-17T16:33:17.571Z] 	/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so: mach-o, but wrong architecture

Functions:

  HttpTrigger: [GET,POST] http://localhost:7071/api/HttpTrigger

How to reproduce

>virtualenv .venv
>source .venv/bin/activate
>func init
>>3 (python)
>func new
>>5 (HttpTrigger)
>func host start

System

>func -V
3.0.3233
>uname - a
Darwin hostname 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec  2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101 arm64```

>python -V
Python 3.7.9

Additional info
Curiously when trying to run the function from within vscode I get a different, but similar error
ModuleNotFoundError: No module named '_ctypes'
Maybe that's a hint as to whats going on.

Full error in VSCode terminal
> Executing task: .venv/bin/python -m pip install -r requirements.txt <

Requirement already satisfied: azure-functions in ./.venv/lib/python3.7/site-packages (from -r requirements.txt (line 3)) (1.5.0)

Terminal will be reused by tasks, press any key to close it.

> Executing task: . .venv/bin/activate && func host start <

source /Users/username/c/my-function-project/.venv/bin/activate
Found Python version 3.7.9 (python3).

Azure Functions Core Tools
Core Tools Version:       3.0.3233 Commit hash: d1772f733802122a326fa696dd4c086292ec0171 
Function Runtime Version: 3.0.15193.0

[2021-01-17T16:39:30.631Z] Traceback (most recent call last):
[2021-01-17T16:39:30.634Z]   File "/Users/username/.pyenv/versions/3.7.9/lib/python3.7/runpy.py", line 193, in _run_module_as_main
[2021-01-17T16:39:30.635Z]     "__main__", mod_spec)
[2021-01-17T16:39:30.635Z]   File "/Users/username/.pyenv/versions/3.7.9/lib/python3.7/runpy.py", line 85, in _run_code
[2021-01-17T16:39:30.635Z]     exec(code, run_globals)
[2021-01-17T16:39:30.635Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/__main__.py", line 43, in <module>
[2021-01-17T16:39:30.635Z]     from debugpy.server import cli
[2021-01-17T16:39:30.635Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/../debugpy/server/__init__.py", line 9, in <module>
[2021-01-17T16:39:30.636Z]     import debugpy._vendored.force_pydevd  # noqa
[2021-01-17T16:39:30.636Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/../debugpy/_vendored/force_pydevd.py", line 54, in <module>
[2021-01-17T16:39:30.636Z]     'pydevd',
[2021-01-17T16:39:30.636Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/../debugpy/_vendored/__init__.py", line 128, in preimport
[2021-01-17T16:39:30.636Z]     import_module(name)
[2021-01-17T16:39:30.636Z]   File "/Users/username/.pyenv/versions/3.7.9/lib/python3.7/importlib/__init__.py", line 127, in import_module
[2021-01-17T16:39:30.636Z]     return _bootstrap._gcd_import(name[level:], package, level)
[2021-01-17T16:39:30.636Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 32, in <module>
[2021-01-17T16:39:30.636Z]     from _pydevd_bundle import pydevd_utils
[2021-01-17T16:39:30.636Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_utils.py", line 8, in <module>
[2021-01-17T16:39:30.636Z]     import ctypes
[2021-01-17T16:39:30.636Z]   File "/Users/username/.pyenv/versions/3.7.9/lib/python3.7/ctypes/__init__.py", line 7, in <module>
[2021-01-17T16:39:30.636Z]     from _ctypes import Union, Structure, Array
[2021-01-17T16:39:30.637Z] ModuleNotFoundError: No module named '_ctypes'
[2021-01-17T16:39:30.668Z] Traceback (most recent call last):
[2021-01-17T16:39:30.669Z]   File "/Users/username/.pyenv/versions/3.7.9/lib/python3.7/runpy.py", line 193, in _run_module_as_main
[2021-01-17T16:39:30.669Z]     "__main__", mod_spec)
[2021-01-17T16:39:30.669Z]   File "/Users/username/.pyenv/versions/3.7.9/lib/python3.7/runpy.py", line 85, in _run_code
[2021-01-17T16:39:30.669Z]     exec(code, run_globals)
[2021-01-17T16:39:30.669Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/__main__.py", line 43, in <module>
[2021-01-17T16:39:30.688Z]     from debugpy.server import cli
[2021-01-17T16:39:30.689Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/../debugpy/server/__init__.py", line 9, in <module>
[2021-01-17T16:39:30.689Z]     import debugpy._vendored.force_pydevd  # noqa
[2021-01-17T16:39:30.689Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/../debugpy/_vendored/force_pydevd.py", line 54, in <module>
[2021-01-17T16:39:30.689Z]     'pydevd',
[2021-01-17T16:39:30.689Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/../debugpy/_vendored/__init__.py", line 128, in preimport
[2021-01-17T16:39:30.689Z]     import_module(name)
[2021-01-17T16:39:30.689Z]   File "/Users/username/.pyenv/versions/3.7.9/lib/python3.7/importlib/__init__.py", line 127, in import_module
[2021-01-17T16:39:30.689Z]     return _bootstrap._gcd_import(name[level:], package, level)
[2021-01-17T16:39:30.690Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 32, in <module>
[2021-01-17T16:39:30.690Z]     from _pydevd_bundle import pydevd_utils
[2021-01-17T16:39:30.690Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_utils.py", line 8, in <module>
[2021-01-17T16:39:30.693Z]     import ctypes
[2021-01-17T16:39:30.693Z]   File "/Users/username/.pyenv/versions/3.7.9/lib/python3.7/ctypes/__init__.py", line 7, in <module>
[2021-01-17T16:39:30.693Z]     from _ctypes import Union, Structure, Array
[2021-01-17T16:39:30.694Z] ModuleNotFoundError: No module named '_ctypes'

Functions:

      HttpTrigger: [GET,POST] http://localhost:7071/api/HttpTrigger

For detailed output, run func with --verbose flag.
[2021-01-17T16:39:30.814Z] Traceback (most recent call last):
[2021-01-17T16:39:30.815Z]   File "/Users/username/.pyenv/versions/3.7.9/lib/python3.7/runpy.py", line 193, in _run_module_as_main
[2021-01-17T16:39:30.815Z]     "__main__", mod_spec)
[2021-01-17T16:39:30.815Z]   File "/Users/username/.pyenv/versions/3.7.9/lib/python3.7/runpy.py", line 85, in _run_code
[2021-01-17T16:39:30.815Z]     exec(code, run_globals)
[2021-01-17T16:39:30.815Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/__main__.py", line 43, in <module>
[2021-01-17T16:39:30.817Z]     from debugpy.server import cli
[2021-01-17T16:39:30.817Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/../debugpy/server/__init__.py", line 9, in <module>
[2021-01-17T16:39:30.817Z]     import debugpy._vendored.force_pydevd  # noqa
[2021-01-17T16:39:30.817Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/../debugpy/_vendored/force_pydevd.py", line 54, in <module>
[2021-01-17T16:39:30.817Z]     'pydevd',
[2021-01-17T16:39:30.817Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/../debugpy/_vendored/__init__.py", line 128, in preimport
[2021-01-17T16:39:30.817Z]     import_module(name)
[2021-01-17T16:39:30.817Z]   File "/Users/username/.pyenv/versions/3.7.9/lib/python3.7/importlib/__init__.py", line 127, in import_module
[2021-01-17T16:39:30.817Z]     return _bootstrap._gcd_import(name[level:], package, level)
[2021-01-17T16:39:30.817Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 32, in <module>
[2021-01-17T16:39:30.817Z]     from _pydevd_bundle import pydevd_utils
[2021-01-17T16:39:30.817Z]   File "/Users/username/.vscode/extensions/ms-python.python-2020.12.424452561/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_utils.py", line 8, in <module>
[2021-01-17T16:39:30.817Z]     import ctypes
[2021-01-17T16:39:30.817Z]   File "/Users/username/.pyenv/versions/3.7.9/lib/python3.7/ctypes/__init__.py", line 7, in <module>
[2021-01-17T16:39:30.817Z]     from _ctypes import Union, Structure, Array
[2021-01-17T16:39:30.817Z] ModuleNotFoundError: No module named '_ctypes'
@anthonychu
Copy link
Member

@Hazhzeng @vrdmr can you help? Thanks.

@apawast
Copy link

apawast commented Jan 21, 2021

@Valansch thank you for reporting this issue. We are working to reproduce this issue. In the meantime, we have not yet validated support on m1, so we will need to go through that process before we can assure compatibility.

@Valansch
Copy link
Author

Thank you for your reply. I know the M1 is not officially supported. But If you find a workaround in the meantime I would be grateful if you could share it here.

@Valansch
Copy link
Author

One piece of information that I left out of the original issue:
When initially setting up the azure functions core tool I could actually run and debug the function.
I do not know what changed to cause it to break and after investigating the issue I do not understand why it worked in the first place...

@jimbobbennett
Copy link

I'm having similar problems - open #2397 for my issue. In may case adding the Azure IoT Python SDK caused the issue.

@vrdmr
Copy link
Member

vrdmr commented Jan 22, 2021

Hi @Valansch,

Looks like gRPC doesn't have an M1 wheel yet (required for python runtime to communicate with the host) - https://pypi.org/project/grpcio/#files. This is why this won't work correctly. I don't know if pip install grpcio builds it correctly from the source. We are trying that from our end.

This is a surprise for me.

When initially setting up the azure functions core tool I could actually run and debug the function.
I do not know what changed to cause it to break and after investigating the issue I do not understand why it worked in the first place...

Could you try the following in the terminal (not in VSCode, and not debugging) -

.venv/bin/activate
func host start

And paste the output?

Edit -
Re read your message. The first stack trace for that info. So got my answer. Can you please re-install CoreTools and the output of func host start again?

@Valansch
Copy link
Author

You are right pip install grpci does not build:

Collecting grpcio
  Using cached grpcio-1.35.0.tar.gz (21.2 MB)
    ERROR: Command errored out with exit status 1:
     command: /Users/maik/.pyenv/versions/3.7.9/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/70/r92dd97s2ng7t5x8z7gdkg100000gn/T/pip-install-tekzcz1v/grpcio_027c4e67271140139d5ca13cff1535b8/setup.py'"'"'; __file__='"'"'/private/var/folders/70/r92dd97s2ng7t5x8z7gdkg100000gn/T/pip-install-tekzcz1v/grpcio_027c4e67271140139d5ca13cff1535b8/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/70/r92dd97s2ng7t5x8z7gdkg100000gn/T/pip-pip-egg-info-cfpz33t9
         cwd: /private/var/folders/70/r92dd97s2ng7t5x8z7gdkg100000gn/T/pip-install-tekzcz1v/grpcio_027c4e67271140139d5ca13cff1535b8/
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/maik/.pyenv/versions/3.7.9/lib/python3.7/site-packages/setuptools/__init__.py", line 19, in <module>
        from setuptools.dist import Distribution
      File "/Users/maik/.pyenv/versions/3.7.9/lib/python3.7/site-packages/setuptools/dist.py", line 34, in <module>
        from setuptools import windows_support
      File "/Users/maik/.pyenv/versions/3.7.9/lib/python3.7/site-packages/setuptools/windows_support.py", line 2, in <module>
        import ctypes
      File "/Users/maik/.pyenv/versions/3.7.9/lib/python3.7/ctypes/__init__.py", line 7, in <module>
        from _ctypes import Union, Structure, Array
    ModuleNotFoundError: No module named '_ctypes'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Installing CoreTools again does not change anything for me:

func host start
Found Python version 3.7.9 (python3).

Azure Functions Core Tools
Core Tools Version:       3.0.3233 Commit hash: d1772f733802122a326fa696dd4c086292ec0171
Function Runtime Version: 3.0.15193.0

[2021-01-23T08:08:00.622Z] Traceback (most recent call last):
[2021-01-23T08:08:00.627Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/worker.py", line 84, in <module>
[2021-01-23T08:08:00.628Z]     from azure_functions_worker import main
[2021-01-23T08:08:00.628Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/azure_functions_worker/main.py", line 8, in <module>
[2021-01-23T08:08:00.628Z]     from . import dispatcher
[2021-01-23T08:08:00.628Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/azure_functions_worker/dispatcher.py", line 21, in <module>
[2021-01-23T08:08:00.628Z]     import grpc
[2021-01-23T08:08:00.628Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/__init__.py", line 23, in <module>
[2021-01-23T08:08:00.628Z]     from grpc._cython import cygrpc as _cygrpc
[2021-01-23T08:08:00.629Z] ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so, 2): no suitable image found.  Did find:
[2021-01-23T08:08:00.630Z] 	/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so: mach-o, but wrong architecture
[2021-01-23T08:08:00.630Z] 	/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so: mach-o, but wrong architecture

Functions:

	HttpTrigger: [GET,POST] http://localhost:7071/api/HttpTrigger

For detailed output, run func with --verbose flag.
[2021-01-23T08:08:00.904Z] Traceback (most recent call last):
[2021-01-23T08:08:00.904Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/worker.py", line 84, in <module>
[2021-01-23T08:08:00.904Z]     from azure_functions_worker import main
[2021-01-23T08:08:00.904Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/azure_functions_worker/main.py", line 8, in <module>
[2021-01-23T08:08:00.904Z]     from . import dispatcher
[2021-01-23T08:08:00.904Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/azure_functions_worker/dispatcher.py", line 21, in <module>
[2021-01-23T08:08:00.904Z]     import grpc
[2021-01-23T08:08:00.904Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/__init__.py", line 23, in <module>
[2021-01-23T08:08:00.904Z]     from grpc._cython import cygrpc as _cygrpc
[2021-01-23T08:08:00.904Z] ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so, 2): no suitable image found.  Did find:
[2021-01-23T08:08:00.904Z] 	/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so: mach-o, but wrong architecture
[2021-01-23T08:08:00.904Z] 	/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so: mach-o, but wrong architecture
[2021-01-23T08:08:01.183Z] Traceback (most recent call last):
[2021-01-23T08:08:01.193Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/worker.py", line 84, in <module>
[2021-01-23T08:08:01.193Z]     from azure_functions_worker import main
[2021-01-23T08:08:01.193Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/azure_functions_worker/main.py", line 8, in <module>
[2021-01-23T08:08:01.193Z]     from . import dispatcher
[2021-01-23T08:08:01.193Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/azure_functions_worker/dispatcher.py", line 21, in <module>
[2021-01-23T08:08:01.193Z]     import grpc
[2021-01-23T08:08:01.193Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/__init__.py", line 23, in <module>
[2021-01-23T08:08:01.194Z]     from grpc._cython import cygrpc as _cygrpc
[2021-01-23T08:08:01.194Z] ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so, 2): no suitable image found.  Did find:
[2021-01-23T08:08:01.195Z] 	/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so: mach-o, but wrong architecture
[2021-01-23T08:08:01.195Z] 	/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3233/workers/python/3.7/OSX/X64/grpc/_cython/cygrpc.cpython-37m-darwin.so: mach-o, but wrong architecture
[2021-01-23T08:08:01.197Z] Exceeded language worker restart retry count for runtime:python. Shutting down and proactively recycling the Functions Host to recover

However I found a workaround here:
apple/tensorflow_macos#48

Using the python 3.8.2 shipped from xcode allows me to run CoreTools again.
I have been using python from pyenv before, that probably broke it.

This workaround works for me. If you need any info from me in order to fix this issue I will gladly help.

@ejizba
Copy link
Contributor

ejizba commented Nov 18, 2021

Consolidating M1 issues. Will use Azure/azure-functions-python-worker#915 for Python work and #2834 for core tools

@ejizba ejizba closed this as completed Nov 18, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Dec 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants