I'm using RStudio and have been trying to use the rPython package to do some email handling for me. This involves unpacking some email attachments so I need to use a newer version of Python than 2.7.
I am on ubuntu so I've set environment variables in a bash script which I can see has worked:
bash
alias python=python3
export RPYTHON_PYTHON_VERSION=3
command line
echo $RPYTHON_PYTHON_VERSION
3
And yet, when I install rPython in RStudio it says:
Installing package into ‘/home/richardc/R/x86_64-pc-linux-gnu-library/3.1’ (as ‘lib’ is unspecified) trying URL 'http://cran.rstudio.com/src/contrib/rPython_0.0-5.tar.gz' Content type 'application/x-gzip' length 37109 bytes (36 Kb)
opened URL
downloaded 36 Kb
- installing source package ‘rPython’ ... ** package ‘rPython’ successfully unpacked and MD5 sums checked a specific python version to use was not provided defaulting to the standard python in the system
So, despite python --version returning 3.4 and setting the environment variable it is defaulting to 2.7
I'm hoping that there is something straightforward I'm missing.
@nickbloom was actually close to it, but it is not
Sys.setenv(RPYTHON_PYTHON_PATH=3)
butSys.setenv(RPYTHON_PYTHON_VERSION=3)
In my case (I have Python 3.5) it was:
As you can see now it is looking for python3.5-config, which is the version I specified above.
Also if your python3.5-config file is not in the PATH then you might also want to set the PATH:
You might also need to rename python3.5m-config, because rPython always looks for [pythoncommand]-config, which in my case was python3.5 and not python3.5m, so I just renamed python3.5m-config to python3.5-config and then the rPython package has installed.