2

I have Anaconda installed in my system with Python 3.5. When I run:

$ which python 

in the terminal, it correctly shows the intended one i.e. the one within Anaconda. When typed:

$ python --version

it shows Python 3.5.3. Now when I installed the rPython package in R, it is taking the python from usr/bin/python which is Python 2.7.12.

How to set the correct python interpreter for R using rPython?

Thanks in advance

3
2

From the rPython INSTALL manual:

In systems where several Python versions coexist, the user can choose the Python version to use at installation time. By default, the package will be installed using the Python version given by

$ python --version

but it is possible to select a different one if the PYTHON_PYTHON_VERSION environment variable is appropriately set.

For instance, if it is defined as

RPYTHON_PYTHON_VERSION=3.2

it will try to use Python 3.2 (looking for python3.2 and python3.2-config in the path). If set to

RPYTHON_PYTHON_VERSION=3

it will install against the "canonical" Python version in the system within the 3.x branch.

Ergo, you need to start R with the environment variable RPYTHON_PYTHON_VERSION set to 3, e. g.:

RPYTHON_PYTHON_VERSION=3 R

The same applies if you're using R with some front-end.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.