After installing (successfully) tensorflow-metal in arm64 venv (which is working); importing tensorflow in other existing x86 python environments (anaconda) results in illegal hardware instruction error)

Hi,

the headline says it basically.

I installed tensorflow-metal via https://developer.apple.com/metal/tensorflow-plugin/ in a new python arm64 environment and it works fine on the mac silicon but the "old" / previously existing Intel based environments crash when Tensorflow is imported (from their intel based environment). The same error occurs when I try to import Tensorflow in python in a new created environment.

The error (in illegal hardware instruction error in python & below as snipped from the Full Error Report) should indicate that I try to import tensorflow with arm64 dependencies in the x86 python environment (?)

Is there a central dependency that all environments use (e.g., to xcode tools)?

If so how can I "break" the dependency? Or what else is the problem?

Cheers for any advice, Ralf


Translated Report (Full Report Below)

Process: python3.9 [4506] Path: /Users/USER/*/python3.9 Identifier: python3.9 Version: ??? Code Type: X86-64 (Translated) Parent Process: zsh [4489] Responsible: Terminal [2340] User ID: 501

Date/Time: 2022-11-11 22:35:30.8426 +0100 OS Version: macOS 13.0.1 (22A400) Report Version: 12 Anonymous UUID: 80661AD4-199E-2752-9885-3E0092AFA20B

Time Awake Since Boot: 3800 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000

Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction: 4 Terminating Process: exc handler [4506]

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libtensorflow_framework.2.dylib 0x16820f064 tensorflow::monitoring::MetricDef<(tensorflow::monitoring::MetricKind)1, long long, 2>::MetricDef<char [11], char [7]>(absl::lts_20210324::string_view, absl::lts_20210324::string_view, char const (&) [11], char const (&) [7]) + 68 1 libtensorflow_framework.2.dylib 0x16820747b tensorflow::monitoring::Counter<2>* tensorflow::monitoring::Counter<2>::New<char const (&) [46], char const (&) [58], char const (&) [11], char const (&) [7]>(char const (&) [46], char const (&) [58], char const (&) [11], char const (&) [7]) + 91 2 libtensorflow_framework.2.dylib 0x168213661 _GLOBAL__sub_I_loader.cc + 49 3 dyld 0x204947618 invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 172 4 dyld 0x204986c4d invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 132 5 dyld 0x20497aef7 invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 557 6 dyld 0x20492d0b7 dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 245 7 dyld 0x20497a0a7 dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const + 175 8 dyld 0x20497c7ea dyld3::MachOFile::forEachInitializerPointerSection(Diagnostics&, void (unsigned int, unsigned int, bool&) block_pointer) const + 116 9 dyld 0x204986882 dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 390