Error: Error creating conda environment 'r-reticulate' [exit code 126]

I'm using MacBook Air (M1, 2020). By default, it came with python2. I installed python3 via homebrew & this is the output on the terminal

➜  ~ which python
/usr/bin/python
➜  ~ which python3
/opt/homebrew/bin/python3

I'm creating an LSTM model in R. However, I'm finding challenges installing tensorflow in R based on this walkthrough TensorFlow for R - Quick start.

library(reticulate)
path_to_python <- "/opt/homebrew/bin/python3"
virtualenv_create("r-reticulate", python = path_to_python)
library(tensorflow)
install_tensorflow(envname = "r-reticulate")

The error below comes up, when I specifically run install_tensorflow(envname = "r-reticulate")

Installing: tensorflow-deps==2.6
+ '/Users/myname/Library/r-miniconda-arm64/bin/conda' 'create' '--yes' '--name' 'r-reticulate' 'python' '--quiet' '-c' 'apple' '-c' 'conda-forge'
sh: /Users/myname/Library/r-miniconda-arm64/bin/conda: /Users/molo/Library/r-miniconda-arm64/bin/python: bad interpreter: No such file or directory
Error: Error creating conda environment 'r-reticulate' [exit code 126]

Based on the reticulate package, below is the output of py_config() function

> py_config()
python:         /usr/bin/python3
libpython:      /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/config-3.8-darwin/libpython3.8.dylib
pythonhome:     /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8:/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8
version:        3.8.2 (default, Jun  8 2021, 11:59:35)  [Clang 12.0.5 (clang-1205.0.22.11)]
numpy:           [NOT FOUND]
tensorflow:     [NOT FOUND]

NOTE: Python version was forced by use_python function

What could be the problem?

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.