Run ARM64 Python from an x86_64 Application Through Rosetta on Apple Silicon

Hello,

Our application currently runs through Rosetta on Apple Silicon. It relies on Python dependencies that utilize kernel extensions (kext). Since kext cannot be executed through Rosetta, we're facing a challenge.

We're considering two main strategies:

  1. Migrating all dependencies to ARM architecture: This would eliminate the need for Rosetta but is costly and time-consuming.
  2. Forcing Python to run in ARM mode: This would allow us to interact with kext from our app running under Rosetta. However, it's unclear if this approach is feasible or effective.

We've explored running Python in ARM mode using PythonKit. We installed arm64 Python packages to try to force Python to run in arm64 but Python continues to execute in x86_64 mode. It appears there isn't a straightforward option to force PythonKit to use an ARM64 Python binary, as there's no specific python3-arm binary or similar that we can point to like python3-intel.

Is there a way to force PythonKit to run Python in ARM64 mode from an application that's running under Rosetta on Apple Silicon?