causalimages-software icon indicating copy to clipboard operation
causalimages-software copied to clipboard

Complications with Building Backend with Apple Silicon Powered Devices

Open WarrenZhu050413 opened this issue 1 year ago • 1 comments

I am not entirely certain, but it seems like Macbook doesn't work with the current default install (at least when I do it manually) since it installs x86-64 versions of the packages when Mac needs ARM64. I am not sure whether it is a general problem, but seems good to flag.

Error Message Error: /Users/wz/opt/anaconda3/envs/CausalImagesEnv/lib/libpython3.11.dylib - dlopen(/Users/wz/opt/anaconda3/envs/CausalImagesEnv/lib/libpython3.11.dylib, 0x000A): tried: '/Users/wz/opt/anaconda3/envs/CausalImagesEnv/lib/libpython3.11.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/wz/opt/anaconda3/envs/CausalImagesEnv/lib/libpython3.11.dylib' (no such file), '/Users/wz/opt/anaconda3/envs/CausalImagesEnv/lib/libpython3.11.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

Solution

curl -L https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh -o Miniforge3-MacOSX-arm64.sh

sh Miniforge3-MacOSX-arm64.sh

Conda init zsh

CONDA_SUBDIR=osx-arm64 conda create -n my_arm64_env python=3.11

conda create -n my_arm64_env python=3.11

conda activate my_arm64_env

conda config --env --set subdir osx-arm64

# Check whether python is running on the right platform
python -c "import platform; print(platform.machine())"

WarrenZhu050413 avatar Jul 04 '24 18:07 WarrenZhu050413

Very true; in general most of these packages will require different versions for arm64 vs. x86_64 (as well as for METAL vs. Nvidia vs. AMD GPU). Often, this is handled automatically, but not always.

cjerzak avatar Jul 08 '24 13:07 cjerzak