Abhiishek Chugh
Abhiishek Chugh

Reputation: 11

I am not able to use functions in keras on M1 Mac in R and it is asking me to install arm64e version of miniconda3. What to do?

'''Error in py_initialize(config$python, config$libpython, config$pythonhome, :
/Users/abhiishekchugh/miniconda3/envs/r-reticulate/lib/libpython3.7m.dylib

  • dlopen(/Users/abhiishekchugh/miniconda3/envs/r-reticulate/lib/libpython3.7m.dylib, 0x000A): tried: '/Users/abhiishekchugh/miniconda3/envs/r-reticulate/lib/libpython3.7m.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libpython3.7m.dylib' (no such file)'''

This is the error I get everytime I use keras on M1 Mac as Miniconda3 doesn't have arm support apparently... Is there any work around for this? I am using this in the latest R version 4.1.1 (2021-08-10) Please help me.

Upvotes: 1

Views: 1197

Answers (1)

t-kalinowski
t-kalinowski

Reputation: 1505

The current release of Tensorflow (2.7) does not support M1 Macs. However, there is a lot of on going work in this space. For the time being, until official support is available, Apple is providing a custom build of Tensorflow specifically for M1 Macs. You can install it by following the directions here: https://developer.apple.com/metal/tensorflow-plugin/

Once that is installed, you can point R at the custom installation by setting the environment variable RETICULATE_PYTHON=/path/to/python/bin/python. For reference, you can also refer to the "Apple Silicon" section in https://www.rdocumentation.org/packages/tensorflow/versions/2.6.0/topics/install_tensorflow, or by typing ?tensorflow::install_tensorflow at the R console.

Upvotes: 0

Related Questions