Error launching Azure Function (Python) in Azure Functions & Python 3 container on Apple M1
I'm not 100% sure if this issue is being submitted to the correct repo; however, it looks as though I'm unable to launch a function locally when leveraging the Azure Functions & Python 3 container image when using a device running on Apple Silicon (M1).
When attempting to launch the function using the Run and Debug window within VS Code, I receive the error:
When attempting to launch the function directly from the terminal using func host start, I receive the error:
(.venv) vscode ➜ /workspaces/testing-azure-function $ func host start
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted
(Example) Steps to reproduce:
- Create new folder and open in VS Code
- Remote Container: Add Development Container Configuration Files... (Azure Functions & Python 3)
- Reopen in Container
- Azure Functions: Create Function:
- Python
- Virtual ENV: python3 (3.8.9)
- Trigger: Timer
- Default timer
- Run and Debug: Attach to Python Function
These steps work fine when executed on an Intel machine.
@anthonychu @TsuyoshiUshio Is anything other than x86_64 / amd64 currently supported? I assume the problem here is the intel toolkit is in the image?
@Chuxel It looks as though the image was built as an amd64 image:
$ docker image inspect vsc-another-test-function-d77580e6300e98838357336c32a042e3
<removed for brevity>
"Architecture": "amd64",
"Os": "linux",
And then from inside the instantiated container:
vscode ➜ /workspaces/another-test-function $ uname -a
Linux 74d24f56973e 5.10.25-linuxkit #1 SMP PREEMPT Tue Mar 23 09:24:45 UTC 2021 x86_64 GNU/Linux
@MrThePlague Thanks. Does this reproduce on an intel Mac, Linux, or Windows machine?
Either way, I'll let @anthonychu and @TsuyoshiUshio from the functions team respond further.
@Chuxel Thanks! Everything works correctly with an Intel Mac.
The Azure Functions host and Core Tools only support x86/64 right now. The work to do so still needs to be prioritized so I wouldn't expect to get there in the short term. In addition to the host and CLI, we'll also need to produce ARM builds of language workers (some have native dependencies like gRPC), do a fair bit of testing, and produce multi-arch images.
The Azure Functions host and Core Tools only support x86/64 right now. The work to do so still needs to be prioritized so I wouldn't expect to get there in the short term. In addition to the host and CLI, we'll also need to produce ARM builds of language workers (some have native dependencies like gRPC), do a fair bit of testing, and produce multi-arch images.
Thanks for the reply! That all makes sense; however, my (obviously incorrect) assumption would've been that because this image is built as an amd64 and it's running under x86/64 emulation (as seen above) it still would've worked, albeit with a performance hit.
Was there any solution to this problem ? I have an M1, getting the same error and cant get my function app in docker to work.
@ejizba and team are working on ARM support in Azure Functions toolchain. They might be able to provide some insights on whether the image is able to be run in emulation or if we need to wait for the ARM support to arrive and corresponding multi-arch Core Tools images to ship.
Here's the issue tracking Apple Silicon support in core tools: https://github.com/Azure/azure-functions-core-tools/issues/2834
We have seen some users report success running in x64 emulation, but I don't know the particulars and I don't think any of them were using Docker