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

Support running on M1 Macs [Python] #915

Closed
FabianBruengerPexon opened this issue Feb 16, 2021 · 196 comments · Fixed by #1267
Closed

Support running on M1 Macs [Python] #915

FabianBruengerPexon opened this issue Feb 16, 2021 · 196 comments · Fixed by #1267
Assignees

Comments

@FabianBruengerPexon
Copy link

FabianBruengerPexon commented Feb 16, 2021

Hey,

i am running into issues with python azure function under VSCode. FYI the same example I will present is working fine with JS.

Set up:
Mac M1 Big Sur v11.2.1
python 3.9.1
Core Tools Version: 3.0.3284

I am following the usual workflow: func init, func new, func start. When I start the function, this is what I get:

Found Python version 3.9.1 (python3).

Azure Functions Core Tools
Core Tools Version:       3.0.3284 Commit hash: 98bc25e668274edd175a1647fe5a9bc4ffb6887d 
Function Runtime Version: 3.0.15371.0

Ä2021-02-16T20:28:10.779 Traceback (most recent call last):
Ä2021-02-16T20:28:10.783   File "/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/worker.py", line 84, in <module>
Ä2021-02-16T20:28:10.783     from azure_functions_worker import main
Ä2021-02-16T20:28:10.783   File "/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/azure_functions_worker/main.py", line 8, in <module>
Ä2021-02-16T20:28:10.783     from . import dispatcher
Ä2021-02-16T20:28:10.783   File "/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/azure_functions_worker/dispatcher.py", line 21, in <module>
Ä2021-02-16T20:28:10.783     import grpc
Ä2021-02-16T20:28:10.783   File "/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/grpc/__init__.py", line 23, in <module>
Ä2021-02-16T20:28:10.783     from grpc._cython import cygrpc as _cygrpc
Ä2021-02-16T20:28:10.784 ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/grpc/_cython/cygrpc.cpython-39-darwin.so, 2): no suitable image found.  Did find:
Ä2021-02-16T20:28:10.785  /opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/grpc/_cython/cygrpc.cpython-39-darwin.so: mach-o, but wrong architecture
Ä2021-02-16T20:28:10.788  /opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/grpc/_cython/cygrpc.cpython-39-darwin.so: mach-o, but wrong architecture
Ä2021-02-16T20:28:10.788 Traceback (most recent call last):
Ä2021-02-16T20:28:10.788   File "/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/worker.py", line 84, in <module>
Ä2021-02-16T20:28:10.788     from azure_functions_worker import main
Ä2021-02-16T20:28:10.794   File "/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/azure_functions_worker/main.py", line 8, in <module>
Ä2021-02-16T20:28:10.794     from . import dispatcher
Ä2021-02-16T20:28:10.794   File "/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/azure_functions_worker/dispatcher.py", line 21, in <module>
Ä2021-02-16T20:28:10.794     import grpc
Ä2021-02-16T20:28:10.794   File "/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/grpc/__init__.py", line 23, in <module>
Ä2021-02-16T20:28:10.799     from grpc._cython import cygrpc as _cygrpc
Ä2021-02-16T20:28:10.799 **ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/grpc/_cython/cygrpc.cpython-39-darwin.so, 2): no suitable image found.  Did find:**
Ä2021-02-16T20:28:10.799  /opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/grpc/_cython/cygrpc.cpython-39-darwin.so: mach-o, but wrong architecture
Ä2021-02-16T20:28:10.799  /opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/grpc/_cython/cygrpc.cpython-39-darwin.so: mach-o, but wrong architecture
Ä2021-02-16T20:28:10.799 Traceback (most recent call last):
Ä2021-02-16T20:28:10.800   File "/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/worker.py", line 84, in <module>
Ä2021-02-16T20:28:10.800     from azure_functions_worker import main
Ä2021-02-16T20:28:10.800   File "/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/azure_functions_worker/main.py", line 8, in <module>
Ä2021-02-16T20:28:10.800     from . import dispatcher
Ä2021-02-16T20:28:10.800   File "/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/azure_functions_worker/dispatcher.py", line 21, in <module>
Ä2021-02-16T20:28:10.800     import grpc
Ä2021-02-16T20:28:10.800   File "/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/grpc/__init__.py", line 23, in <module>
Ä2021-02-16T20:28:10.800     from grpc._cython import cygrpc as _cygrpc
Ä2021-02-16T20:28:10.800 **ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/grpc/_cython/cygrpc.cpython-39-darwin.so, 2): no suitable image found.  Did find:**
Ä2021-02-16T20:28:10.800  /opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/grpc/_cython/cygrpc.cpython-39-darwin.so: mach-o, but wrong architecture
Ä2021-02-16T20:28:10.801 Exceeded language worker restart retry count for runtime:python. Shutting down and proactively recycling the Functions Host to recover
Ä2021-02-16T20:28:10.808  /opt/homebrew/Cellar/azure-functions-core-toolsÉ3/3.0.3284/workers/python/3.9/OSX/X64/grpc/_cython/cygrpc.cpython-39-darwin.so: mach-o, but wrong architecture

Functions:

 HttpTrigger: ÄGET,POSTÅ http://localhost:7071/api/HttpTrigger

For detailed output, run func with --verbose flag.

I would appreciate some advice here!
Thanks and all the best

@apawast apawast changed the title HTTP python trigger is not running locally HTTP python trigger is not running locally - [Apple M1] Mar 2, 2021
@apawast
Copy link

apawast commented Mar 2, 2021

@FabianBruengerPexon we are waiting to get the machine to be able to test this.

@isa56k
Copy link

isa56k commented May 25, 2021

I'm also seeing this on M1 Mac Mini running:
Python 3.9.2
Core Tools Version: 3.0.3477 Commit hash: 5fbb9a76fc00e4168f2cc90d6ff0afe5373afc6d (64-bit)
Function Runtime Version: 3.0.15584.0

@simon-tarr
Copy link

Also experiencing this issue. Please see Azure/azure-functions-core-tools#2680

Returning M1 Macbook, sadly, as this issue has clearly been rumbling on for many months!

@jamwil
Copy link

jamwil commented Oct 15, 2021

Still experiencing this on M1 MacBook Pro, Python 3.9.7, Core Tools 3.0.3785.

@lks-hrsch
Copy link

The issue is still present.
M1 MacBook Pro

Core Tools Version: 4.0.3780 Commit hash: 2b9e0e618f69993ff119009e48587b67ac85450e (64-bit)
Function Runtime Version: 4.0.0.16394

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

@boring-joey
Copy link

The issue is still present. M1 MacBook Pro

Core Tools Version: 4.0.3780 Commit hash: 2b9e0e6 (64-bit)
Function Runtime Version: 4.0.0.16394

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

Still got the exact same error. Running two macbooks for this right now, waiting to solve this problem. Lets hope it comes quick in some way.

@anthonychu
Copy link
Member

Looks like Core Tools is able to run in x64 emulation but it’s starting the python worker in ARM. The worker uses x64 binaries in some places and that’s where it appears to be failing. Are you able to run the entire stack with x64 emulation? I only have an Intel Mac so I can’t try this out.

/cc @vrdmr

@anthonychu
Copy link
Member

For Node.js we were able to fix this by using a pure JS implementation of gRPC that doesn’t rely on platform specific binaries.
Not sure if same exists for Python. Azure/azure-functions-nodejs-worker#386

@simon-tarr
Copy link

Unable to test this at present but (thinking out loud here): I'm wondering if running everything in a conda environment of some description would help in the interim? Using conda environments has solved a ton of (unrelated) problems for me over the past few months while x86 and arm64 code is living side by side.

@lks-hrsch
Copy link

Looks like Core Tools is able to run in x64 emulation but it’s starting the python worker in ARM. The worker uses x64 binaries in some places and that’s where it appears to be failing. Are you able to run the entire stack with x64 emulation? I only have an Intel Mac so I can’t try this out.

/cc @vrdmr

This was a good hint, thank you! I was able to start func start host without an error on my M1 Macbook Pro.

What have I done?

  1. Enable Rosetta in iTerm so that you get the following output:

$ arch
i386

  1. install the intel homebrew with:

$ arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

refer to https://stackoverflow.com/questions/64882584/how-to-run-the-homebrew-installer-under-rosetta-2-on-m1-macbook
3. install azure-functions-core-tools@4 and python in this homebrew
4. setting python path to the rosetta python
5. run the command:

$ arch -x86_64 /usr/local/bin/func start host

@ejizba ejizba changed the title HTTP python trigger is not running locally - [Apple M1] Support running on M1 Macs [Python] Nov 18, 2021
@ejizba ejizba transferred this issue from Azure/azure-functions-core-tools Nov 18, 2021
@ejizba
Copy link

ejizba commented Nov 18, 2021

Cleaning up M1 Mac issues at the moment. This one seemed like the most detailed Python issue, so I've transferred it here to track any Python-specific work. Main core tools issue is here: Azure/azure-functions-core-tools#2834

Also this comment from @vrdmr seems particularly relevant: Azure/azure-functions-core-tools#2394 (comment)

@ericdwkim
Copy link

Also experiencing this issue.

M1 Macbook Pro
Python 3.9.4
Core Tools Version: 4.0.3971

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

@ejizba
Copy link

ejizba commented Feb 4, 2022

Fyi @vrdmr I've created an arm64 build of core tools and I now see this error when running on an M1 Mac:

Failed to initialize worker provider for: /Users/erijiz/tools/func-arm/workers/python
Microsoft.Azure.WebJobs.Script: Architecture Arm64 is not supported for language python.

I believe that's because Arm64 is not listed in the worker config here. Let me know when you have an arm64 build of the worker and I'd be happy to test for you.

@felixnext
Copy link

Running into the same issue as @ericdwkim. Also noted that this works with python 3.8 environments, but not with python 3.9. Is there an ETA for the fix @ejizba?

@yugyesh
Copy link

yugyesh commented Mar 23, 2022

The best work around I have found is to use python interpreter installed in 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/`

@felixnext

@kentongray
Copy link

kentongray commented Apr 11, 2022

For the wary traveller, I have tried a bunch of these without success and wasn't willing to switch to x86, this trick, while maybe bad practice, worked for me (basically copying over the binary):
Azure/azure-functions-core-tools#2834 (comment)

@tkutcher
Copy link

Any updates on this? Silver lining is it's forced me to write more testing harnesses 😬 , but it's getting a little tricky to troubleshoot in some scenarios..

@shreyabatra4
Copy link
Contributor

shreyabatra4 commented May 12, 2022

Hi, this issue should be resolved with the release of support for Python 3.10 in Functions, which is planned for end of May.

@kijewskimateusz
Copy link

Hi @shreyabatra4 Do you maybe have any info on estimated release date for Function App Python3.10 support?

@0xdubs
Copy link

0xdubs commented Jun 7, 2022

^I have the same question

@kijewskimateusz
Copy link

@danielw1534 In the meantime you can try this workaround

@BadrElfarri
Copy link

Is this fixed? non of the workaround works for me

@iPypeNB
Copy link

iPypeNB commented Oct 31, 2023

I do not want to sound hater, but seriously I have not known functionality that has had so many delays, it is incredible that since 2021 is promising that this functionality will come out and nothing. It already seems to me a lack of respect to all users that they have decided not to respond so as not to continue to look bad. please report what is happening with this new release?

@shreyabatra4
Copy link
Contributor

shreyabatra4 commented Nov 9, 2023

Hi everyone - thank you again for all your patience with this release! I empathize with your comments on the multiple delays of this release, and we really appreciate your understanding and feedback.

I do have some good news - support for ARM 64 is now released! Please upgrade to the newest Core Tools (4.0.5455) to try it out.

I will close this issue out alongside our official announcement for this feature! Please comment and let us know if you have any feedback when trying it out.

@himanshu-ram-punjabi
Copy link

Thank you for the update, Shreya. I look forward to the official documentation to try this on the MacBook.

@dzsquared
Copy link

available in brew, thanks @shreyabatra4!
image

@Yurockkk
Copy link

Worked like a charm, all I need to do is to upgrade to the latest version of azure-functions-core-tool. thanks @shreyabatra4!

@lucasfijen
Copy link

lucasfijen commented Nov 14, 2023

Thank you for releasing this @shreyabatra4!
I'm still running into some issues when trying to get this version installed on a devcontainer on a mac:
E: Unable to locate package azure-functions-core-tools-4
Could it be that the azure function is not released in the packages to ARM64 folder?
When checking the packages in https://packages.microsoft.com/debian/11/prod/dists/bullseye/main/binary-arm64/ I don't see any azure-functions-core-tools mentioned, while the https://packages.microsoft.com/debian/11/prod/dists/bullseye/main/binary-amd64/ Does contain the latest version.

Are these supposed to be there, or am I asking something impossible here?

Install script used in docker building script which works on a amd64 computer, but not on a arm64 macbook:

# Install func core tools
DEBIAN_VERSION=11

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/debian/$DEBIAN_VERSION/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list

sudo apt-get update
sudo apt-get install azure-functions-core-tools-4

@dwgreen1
Copy link

Works like a charm for me. Thanks so much!

@r-findley
Copy link

The new solution worked (mostly) great for me. Has anyone gotten the warning "Customer packages not in sys path. This should never happen!" when running the func start command? I get this from any Azure Function project, both ones that I have created a new environment for since the update and those from prior to the update. I do not, however, get this on any other Python project on my computer, suggesting this could be related to the Core Tools.

@vrdmr
Copy link
Member

vrdmr commented Nov 14, 2023

@lucasfijen - For your issue - are you installing core tools inside docker running on your Mac?

Install script used in docker building script which works on a amd64 computer, but not on a arm64 macbook:

@r-findley - This is an issue that we caused due to incorrect logging, and the fix (#1335 from @hallvictoria) will be part of the next release of the Functions (host + core tools). Please ignore this log for the time being - it is a red herring.

@vrdmr
Copy link
Member

vrdmr commented Nov 14, 2023

Closing this issue - Apologies for the delay, and we will work towards ensuring faster releases and getting them out sooner.

Thanks a lot for continuing to use Python Functions and we'd love to hear your feedback on M1 and other features.

@patrick-cichon-gcx
Copy link

@vrdmr

When I try to start the function I get the following error in my terminal:

[2023-11-15T08:24:49.287Z] ImportError: cannot import name 'cygrpc' from 'grpc._cython' (/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5455/workers/python/3.10/OSX/Arm64/grpc/_cython/__init__.py)
[2023-11-15T08:24:49.291Z] Language Worker Process exited. Pid=83729.
[2023-11-15T08:24:49.291Z] python3 exited with code 1 (0x1). ImportError: cannot import name 'cygrpc' from 'grpc._cython' (/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5455/workers/python/3.10/OSX/Arm64/grpc/_cython/__init__.py),ImportError: cannot import name 'cygrpc' from 'grpc._cython' (/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5455/workers/python/3.10/OSX/Arm64/grpc/_cython/__init__.py),ImportError: cannot import name 'cygrpc' from 'grpc._cython' (/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5455/workers/python/3.10/OSX/Arm64/grpc/_cython/__init__.py).
[2023-11-15T08:24:49.292Z] Exceeded language worker restart retry count for runtime:python. Shutting down and proactively recycling the Functions Host to recover

The command I'm using to start the function is func start --python. I'm executing this command from the same directory where the host.json is located.

@lucasfijen
Copy link

lucasfijen commented Nov 15, 2023

@vrdmr

@lucasfijen - For your issue - are you installing core tools inside docker running on your Mac?

I'm trying to install it indeed at the building scripts of my devcontainer.

I tried this in 2 ways, either with:
the feature "ghcr.io/jlaundry/devcontainer-features/azure-functions-core-tools:1": "latest", in devcontainer.json,

or with a postcreatecommand in which I added:

DEBIAN_VERSION=11

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/debian/$DEBIAN_VERSION/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list

sudo apt-get update
sudo apt-get install azure-functions-core-tools-4

Both return the same unable to locate azure-functions-core-tools.

I think the issue is that brew is not available in a debian based devcontainer, but as for the links in my previous command, the arm64 based debian packages are not published where these methods will be searching.

@alfechner
Copy link

@lucasfijen I'm running into the same issue when trying to install it in a Docker container. Did you sort out this issue? Thanks!

@lucasfijen
Copy link

@lucasfijen I'm running into the same issue when trying to install it in a Docker container. Did you sort out this issue? Thanks!

Unfortunately I haven't yet, still hoping to get some help on this:)

@shreyabatra4
Copy link
Contributor

shreyabatra4 commented Nov 22, 2023

Closing out this issue as support for Apple Silicon Macs is now released. Please provide feedback by filling out this survey. To fill it in, click "New discussion" and the form will show up.

Thanks all for your patience with this feature once again!

@lakshmanjamili
Copy link

The ticket is closed but I still find an issue using Azure function core tools running on Apple M2 Max chip

Apply Mac Book: `M2 Apple MAX 64 GB`
Installed latest-version of azure function-core tools using `homebrew`

brew tap azure/functions
brew install azure-functions-core-tools@4

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

Found Python version 3.10.13 (python3).

Azure Functions Core Tools
Core Tools Version: 4.0.5455 Commit hash: N/A (64-bit)
Function Runtime Version: 4.27.5.21554

[2024-02-13T02:54:13.203Z] ERROR: unhandled error in functions worker: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5455/workers/python/3.10/OSX/Arm64/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease'
[2024-02-13T02:54:13.902Z] Language Worker Process exited. Pid=13843.
[2024-02-13T02:54:13.902Z] python3 exited with code 1 (0x1). ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5455/workers/python/3.10/OSX/Arm64/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease',ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5455/workers/python/3.10/OSX/Arm64/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease',ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5455/workers/python/3.10/OSX/Arm64/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease'.

@aescolastico
Copy link

aescolastico commented Feb 23, 2024

I can confirm I no longer need to use emulation and an "arch -x86_64" version of homebrew to run func core tools on apple silicon. Thanks for implementing this.

@krutilins
Copy link

It would be helpful to publish the arm64 version to Debian packages, if that's possible :)

Currently, we must use emulation to run Debian-based devcontainer

@VRSupriya
Copy link

I could successfully run "func start" with .venv. But couldn't run it with conda environment.

python -m venv .venv
source .venv/bin/activate
pip3 install virtualenv
.venv/bin/python -m pip install --upgrade pip
pip install -r requirements.txt

@yogeshg
Copy link

yogeshg commented Jul 15, 2024

I still see the issue with apple 4.0.5907

https://functionscdn.azureedge.net/public/4.0.5907/Azure.Functions.Cli.osx-arm64.4.0.5907.zip

@jan-ri
Copy link

jan-ri commented Jul 16, 2024

Same for me, getting errors with version 4.0.5907 on M2 using Python 3.11.9.

@shreyabatra4
Copy link
Contributor

@yogeshg and @jan-ri Can you please provide the error messages you are seeing?

@jan-ri
Copy link

jan-ri commented Jul 16, 2024

Okay nvm... Seems to be a problem after an update. I've done a reinstall in Homebrew at first, which didn't solve the problem. After I performed an uninstall and then install to get a clean reinstall it worked perfectly fine.

@yogeshg
Copy link

yogeshg commented Jul 18, 2024

@shreyabatra4 here we go:

[2024-07-17T23:59:45.872Z]  ERROR: unhandled error in functions worker: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5907/workers/python/3.10/OSX/Arm64/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease'
[2024-07-17T23:59:46.682Z] Language Worker Process exited. Pid=61738.
[2024-07-17T23:59:46.682Z] python3 exited with code 1 (0x1). ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5907/workers/python/3.10/OSX/Arm64/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease',ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5907/workers/python/3.10/OSX/Arm64/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease',ImportError: dlopen(/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.5907/workers/python/3.10/OSX/Arm64/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease'.

@yogeshg
Copy link

yogeshg commented Jul 19, 2024

full command:

% func host start
Found Python version 3.10.14 (python3).

Azure Functions Core Tools
Core Tools Version:       4.0.5907 Commit hash: N/A +807e89766a92b14fd07b9f0bc2bea1d8777ab209 (64-bit)
Function Runtime Version: 4.834.3.22875

[2024-07-19T16:42:50.466Z]  ERROR: unhandled error in functions worker: dlopen(/opt/homebrew/lib/node_modules/azure-functions-core-tools/bin/workers/python/3.10/OSX/Arm64/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease'
[2024-07-19T16:42:50.479Z] Language Worker Process exited. Pid=5037.
[2024-07-19T16:42:50.479Z] python3 exited with code 1 (0x1). ImportError: dlopen(/opt/homebrew/lib/node_modules/azure-functions-core-tools/bin/workers/python/3.10/OSX/Arm64/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease',ImportError: dlopen(/opt/homebrew/lib/node_modules/azure-functions-core-tools/bin/workers/python/3.10/OSX/Arm64/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease',ImportError: dlopen(/opt/homebrew/lib/node_modules/azure-functions-core-tools/bin/workers/python/3.10/OSX/Arm64/grpc/_cython/cygrpc.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease'.

@nikitoshina
Copy link

Having the same issue on M2 Pro python3.10 and core tools 4.0.5907

@ramiayoub-priv
Copy link

As a workaround you can install grpcio using pip in your venv and the copy the whole directory .venv/lib/python3./site-packages/grpc/ to /opt/homebrew/Cellar/azure-functions-core-tools@4/<x.x.xxxx>/workers/python/3./OSX/Arm64/grpc if you installed azure-fuctions-core-tools using homebrew. Otherwise it might be in a different location but the concept is the same. The whole directory needs to be copied to replace the grpc version provided in azure-function-core-tools with the correct one. Not sure why it is broken in core-tools for M1 but been like that for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet