vscode-dev-containers icon indicating copy to clipboard operation
vscode-dev-containers copied to clipboard

Error launching Azure Function (Python) in Azure Functions & Python 3 container on Apple M1

Open MrThePlague opened this issue 5 years ago • 9 comments

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:

Screen Shot 2021-04-26 at 10 55 11 AM

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:

  1. Create new folder and open in VS Code
  2. Remote Container: Add Development Container Configuration Files... (Azure Functions & Python 3)
  3. Reopen in Container
  4. Azure Functions: Create Function:
    • Python
    • Virtual ENV: python3 (3.8.9)
    • Trigger: Timer
      • Default timer
  5. Run and Debug: Attach to Python Function

These steps work fine when executed on an Intel machine.

MrThePlague avatar Apr 26 '21 17:04 MrThePlague

@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 avatar Apr 26 '21 19:04 Chuxel

@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 avatar Apr 26 '21 20:04 MrThePlague

@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 avatar Apr 26 '21 21:04 Chuxel

@Chuxel Thanks! Everything works correctly with an Intel Mac.

MrThePlague avatar Apr 26 '21 22:04 MrThePlague

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.

anthonychu avatar Apr 27 '21 08:04 anthonychu

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.

MrThePlague avatar Apr 27 '21 13:04 MrThePlague

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.

alexis-franche avatar Feb 24 '22 02:02 alexis-franche

@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.

anthonychu avatar Feb 24 '22 05:02 anthonychu

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

ejizba avatar Feb 24 '22 18:02 ejizba