Please excuse my poor or incorrect usage, if any, in the following.
> library(reticulate)
> py_config()
python: /home/<my id>/anaconda3/bin/python
libpython: /home/<my id>/anaconda3/lib/libpython3.5m.so
pythonhome: /home/<my id>/anaconda3:/home/<my id>/anaconda3
version: 3.5.2 |Anaconda custom (64-bit)| (default, Oct 20 2016, 03:10:33) [GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]
numpy: /home/<my id>/anaconda3/lib/python3.5/site-packages/numpy
numpy_version: 1.11.2
python versions found:
/usr/bin/python
/usr/bin/python3
/home/<my id>/anaconda3/bin/python
Attempting to change python version:
> use_python("/usr/bin/python", required = T)
Observe - no apparent change:
> py_config()
python: /home/<my id>/anaconda3/bin/python
libpython: /home/<my id>/anaconda3/lib/libpython3.5m.so
pythonhome: /home/<my id>/anaconda3:/home/<my id>/anaconda3
version: 3.5.2 |Anaconda custom (64-bit)| (default, Oct 20 2016, 03:10:33) [GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]
numpy: /home/<my id>/anaconda3/lib/python3.5/site-packages/numpy
numpy_version: 1.11.2
python versions found:
/usr/bin/python
/usr/bin/python3
/home/<my id>/anaconda3/bin/python
> R.version
_
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 3.3
year 2017
month 03
day 06
svn rev 72310
language R
version.string R version 3.3.3 (2017-03-06)
nickname Another Canoe
>
Shouldn't the result of use_python be reflected in the result of py_config()?
Please let me know if you need more info, thanks.
Best,
CB
> packageVersion("reticulate")
[1] ‘0.7’
>
You can only load one Python interpreter per R session (it can't really be cleanly unloaded without messy side effects that cause crashes down the road) so the use_python call only applies before you actually initialize the interpreter.
To any newbies out there (like me), this means do:
library("reticulate")
use_python("/usr/bin/python", required = T)
Before anything else. Check with
py_config()
I actually do:
reticulate::use_python("python3")
library(reticulate)
That doesn’t work, you should do
reticulate::use_python(Sys.which('python3'), required = TRUE)
And there’s no difference if you do it before library(reticulate) or after, as long as it’s before you try to run any other stuff.
Most helpful comment
To any newbies out there (like me), this means do:
Before anything else. Check with