Install native ARM R: https://cloud.r-project.org/
Install RStudio (probably preview) which is not native as of today: https://www.rstudio.com/products/rstudio/download/preview/
This blog post is helpful for getting Tensorflow working, but it is older, before the ARM version of R and the RStudio version that supports it was available.
This other blog post has specific steps outlined, but some of it has also been superseded.
Looks to me like Apple's instructions are the best as of today: https://developer.apple.com/metal/tensorflow-plugin/
Here is what I think you need to do:
- Make sure you have Python 3.8 or Python 3.9
- Install Miniforge for ARM, using
reticulate::install_miniconda()
from within R - Create conda environment for your TensorFlow install (I called it
tf_env
and have had better luck doing it from the command line) - Install packages like numpy, pandas, etc for ARM (try it with
conda install -c apple tensorflow-deps
from Apple's instructions? is that good enough?) - Install base Tensorflow (I have not tried the
tensorflow-metal
yet)
You can turn it on (in the terminal) with conda activate tf_env
and turn it off with conda deactivate
. I have this in my .Renviron
:
RETICULATE_PYTHON = "~/miniforge3/envs/tf_env/bin/python"
Hello - I cannot get tensorflow to work in R Studio. I am running a
I executed all of the steps in the terminal snippet successfully. I then started R Studio and selected what I thought was the correct python interpreter in R Studio via preferences: /usr/local/bin/python3.10 I also checked the "automatically activate ... " button. I also installed the reticulate package. When I then try to install tensorflow I get the following:
> tensorflow::install_tensorflow()
Installing: tensorflow-deps
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done
All requested packages already installed.
Installing: tensorflow-macos
Activated conda python: /usr/local/bin/bin/python
ERROR: Could not find a version that satisfies the requirement tensorflow-macos (from versions: none)
ERROR: No matching distribution found for tensorflow-macos
Error: Error installing package(s): "'tensorflow-macos'"
My environment is as follows:
Environment: macOS Version 12.3.1 Monterey R Studio: 2021.09.2 Build 382 platform x86_64-apple-darwin17.0
arch x86_64
os darwin17.0
system x86_64, darwin17.0
status
major 4
minor 1.2
year 2021
month 11
day 01
svn rev 81115
language R
version.string R version 4.1.2 (2021-11-01) nickname Bird Hippie
Any suggestions would be much appreciated - I have been trying to get tensorflow working on the mac for about a month now ...