Pytensor Import Error MAC M1

Hello, thanks in advance for your help.

I’m trying to install pymc on MAC M1 with poetry. The installation procedure is ok and it ends without errors.

But when i try to use the library the following exception comes out:

ImportError: dlopen(/Users/martaperoni/.pytensor/compiledir_macOS-13.0-arm64-i386-64bit-i386-3.11.4-64/tmp9q2mwofr/mfeba4d434591def33153ec442edc27a735fd9fa46fd5f1fae8efd4f490539b0a.so, 0x0002): tried: ‘/Users/martaperoni/.pytensor/compiledir_macOS-13.0-arm64-i386-64bit-i386-3.11.4-64/tmp9q2mwofr/mfeba4d434591def33153ec442edc27a735fd9fa46fd5f1fae8efd4f490539b0a.so’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’)), ‘/System/Volumes/Preboot/Cryptexes/OS/Users/martaperoni/.pytensor/compiledir_macOS-13.0-arm64-i386-64bit-i386-3.11.4-64/tmp9q2mwofr/mfeba4d434591def33153ec442edc27a735fd9fa46fd5f1fae8efd4f490539b0a.so’ (no such file), ‘/Users/martaperoni/.pytensor/compiledir_macOS-13.0-arm64-i386-64bit-i386-3.11.4-64/tmp9q2mwofr/mfeba4d434591def33153ec442edc27a735fd9fa46fd5f1fae8efd4f490539b0a.so’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’))

the error persists even if i’m trying to install it via pip specifying the arch
arch -arm64 python -m pip install pymc --no-cache

If i check the WHEEL file in site packages the architecture is correctly selected
Wheel-Version: 1.0
Generator: bdist_wheel (0.41.1)
Root-Is-Purelib: false
Tag: cp311-cp311-macosx_13_0_arm64

Can you please help me with this issue? I’m not able to find a solution.

We suggest conda, because it’s tricky to set up the compiler stuff otherwise:

https://www.pymc.io/projects/docs/en/stable/installation.html

1 Like

I can’t use conda, it’s not supported by my production environment.

Does anything that can help come to your mind?

You can try to use the JAX or numba backend which wouldn’t require compilation.

1 Like