Whenever I use reticulate in RStudio, the default REPL is using python2.7
, but I want to use python3
per default.
I have added the python path to python3
to my .bashrc
in the environment variable RETICULATE_PYTHON
and when I use R and reticulate from the command line, Sys.getenv('RETICUALTE_PYTHON')
returns /usr/bin/python3
. If open a REPL in the command line using, I get the correct path. If I do the same in RStudio, I get an empty string.
R
Sys.getenv('RETICULATE_PYTHON')
Return in R (from command line):
[1] "/usr/bin/python3"
in RStudio:
[1] ""
In the RStudio Terminal the output is correct:
echo $RETICULATE_PYTHON
/usr/bin/python3
Also, when I start R from the command line, py_config()
is this:
> library(reticulate)
> py_config()
python: /usr/bin/python3
libpython: /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so
pythonhome: /usr:/usr
version: 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0]
numpy: /usr/lib/python3/dist-packages/numpy
numpy_version: 1.14.5
NOTE: Python version was forced by RETICULATE_PYTHON
But in RStudio it is this:
> library(reticulate)
> py_config()
python: /usr/bin/python
libpython: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
pythonhome: /usr:/usr
version: 2.7.15+ (default, Oct 2 2018, 22:12:08) [GCC 8.2.0]
numpy: /usr/lib/python2.7/dist-packages/numpy
numpy_version: 1.14.5
python versions found:
/usr/bin/python
/usr/bin/python3
Restarting RStudio did not help. Any suggestions on how to make RStudio use the correct python binary as well?