Error when using conda environment with reticulate `incompatible architecture (have 'arm64', need 'x86_64')`

I am setting up a new M1 Mac with an arm processor evidenced by $uname -p returning "arm".

I can set up working conda environments from the terminal, but when I try to create or use a conda environment with reticulate I get the error below, which I can't make sense of. In what sense do I "need" x86_64? Isn't that an older processor?

I'll note that I can create and use virtualenv without issue in reticulate.

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

I guess your R installation is using x86_64 architecture/binaries. M1 Macs will happily execute both x86_64 and arm64 binaries (though using some emulation tech for x86_64)

You can check your architecture if you run sessionInfo() within the R console.

On my M1 based Mac it reports

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.2.1

which clearly shows the use of arm/aarch64.

If I am upgrading to x86_64 R 4.3.2, I get from the same command

R version 4.3.2 (2023-10-31)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.2.1

which now shows x86_64.

I would suggest to try installing the arm64 version of R 4.3.2 (E.g., make sure this version is configured in RStudio (check with sessionInfo()) and then re-try loading the conda-env again. It should work now.

Aligning the architecture of your conda env and the R installation to arm64 will definitely not only give you compatibility between the two but also the best level of performance on your M1 Mac.


This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.