Below are the steps and corresponding output I'm using to install tensorflow in RStudio. The laptop I'm using is Apple M1 chip. The OS is Monterey.
use_python(python = Sys.which("python3"), required = TRUE)
virtualenv_create("r-reticulate", python = Sys.which("python3"))
install_tensorflow(envname = "r-reticulate")
library(tensorflow)
The installation was successful, when I run
library(tensorflow)
tf$constant("Hello Tensorflow!")
This is the output
List of 20
$ python : chr "/usr/bin/python3"
$ libpython : chr "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/config-3.8-"| __truncated__
$ pythonhome : chr "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8:/Library/Developer/Comman"| __truncated__
$ pythonpath : chr "/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/reticulate/config:/Library/Developer/Comma"| __truncated__
$ prefix : chr "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8"
$ exec_prefix : chr "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8"
$ base_exec_prefix : chr "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8"
$ virtualenv : chr ""
$ virtualenv_activate : chr ""
$ version_string : chr "3.8.9 (default, Apr 13 2022, 08:48:06) [Clang 13.1.6 (clang-1316.0.21.2.5)]"
$ version : chr "3.8"
$ architecture : chr "64bit"
$ anaconda : logi FALSE
$ conda : logi FALSE
$ numpy : NULL
$ required_module : chr "tensorflow"
$ required_module_path: NULL
$ available : logi TRUE
$ python_versions : chr "/usr/bin/python3"
$ forced : chr "RETICULATE_PYTHON_FALLBACK"
- attr(*, "class")= chr "py_config"
And this is the error
Error: Python module tensorflow was not found.
Detected Python configuration:
What could be the issue?