I am relatively new to python and would like to install it the "right" way (of which, of course, there are many) to use both natively and with R through reticulate.
Here's what I have done so far:
- I reinstalled MacOS Catalina from scratch and installed Miniconda with homebrew.
- Through miniconda, I have updated to python 3.8.5.
- Then, I installed reticulate in R (R version 4.0.2., RStudio version 1.3.1056). When reticulate asked me whether I wanted to install miniconda, I declined (since it was already installed.
- I aliased python3 with python in my zsh terminal.
This is where the trouble started. I couldn't (and can't) get reticulate to recognize my python installation or, if I can get reticulate to recognize it, I can't get it to recognize my python environment.
As advised elsewhere, I changed my RETICULATE_PYTHON
to /usr/local/bin/python3
, which actually matches one of my python installations. Now I get the error Error: could not find a Python environment for /usr/local/bin/python3
I also tried setting my path to my miniconda python, which is located somewhere in /usr/local/Caskroom/miniconda/base/
. Or more specifically, as obtained by type -a python python3
, in /usr/local/Caskroom/miniconda/base/bin/python3
. Unfortunately, once I changed the reticulate directory to the miniconda version, type
no longer returns /usr/local/Caskroom/miniconda/base/bin/python3
, for reasons that I don't understand.
When I now run type -a python python3
, I receive the following output:
python is an alias for python3
python is /usr/bin/python
python3 is /usr/local/bin/python3
python3 is /usr/local/bin/python3
python3 is /usr/bin/python3
python3 is /usr/local/bin/python3
I don't know what happened to my miniconda installation (which still seems to work fine, when I run conda --version
, I receive conda 4.8.3
).
So to summarize the status quo:
- Running python from the terminal works (both interactive and to execute a py file)
- Reticulate recognizes the path I set in
RETICULATE_PYTHON
- My miniconda no longer appears when I run
type -a python python3
- Most importantly: reticulate does not recognize my environment even though I have created an environment with miniconda in the terminal and another environment in Rstudio using
reticulate::conda_create()
and I have also made sure to activate them.
So my question is, how can I get reticulate to
- Recognize my miniconda python
- Recognize the various environments that I create with conda (both inside and outside of R)