Reputation: 2557
I am running python on a m1 Mac with Rosetta, on a x86_64 architecture.
During the execution I need to use subprocess.run
to launch some external program. However that program need to run under arm64 architecture.
Is there a possible solution for doing that? Simply running from an arm64 terminal does not do the trick, and it gets overridden by the Python architecture.
I am using python==3.8.2
.
Upvotes: 0
Views: 727
Reputation: 2557
The root of the problem was actually not in the subprocess.run
, the process I was trying to spawn was compiled such that the binary is multi-arch support, supporting both arm64 and x86_64 (the support for the latter was mainly launching the program and crashing after not supported error).
As the call for subprocess.run
came from a x86_64 architecture, the binary defaulted to that architecture.
The solution was to just compile the binary only for arm64, with no multi-arch support. After that the process was spawned with the correct architecture, even tho the call was made from a different architecture.
Upvotes: 1