Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tried to guess R's HOME but no R command in the PATH. OsX 10.6

Tags:

python

macos

r

rpy2

I am trying to install rpy2 and I am facing a common issue. Unfortunately all the solution I have found are for win7

I have installed a Python 2.7 and R 2.15. then I write on the terminal

easy_install rpy2

or, alternatively

pip install rpy2

Same result:

Tried to guess R's HOME but no R command in the PATH

What I should do?

like image 223
user2988577 Avatar asked Nov 25 '13 20:11

user2988577


2 Answers

Make sure you have R installed

brew install r

Then install rpy

pip install rpy2
like image 117
louis_guitton Avatar answered Oct 31 '22 20:10

louis_guitton


The rpy2 code is doing the wrong check. R might be perfectly fine, but rpy2 is using an unreliable check.

To check for R, the rpy2 uses subprocess.check_output. However, that was introduced (AFAIK) in python 2.7.

If you're using a version of python less than 2.7 then you should update to at least 2.7.

If you must use python 2.6, then you should look at this answer to see how to force subprocess.check_output into python 2.6, finally allowed you to install rpy2. This is what I had to do as I was unable to update the version of python.

Download the rpy2 code, and edit its setup.py and insert the code from that answer.

like image 2
Aaron McDaid Avatar answered Oct 31 '22 20:10

Aaron McDaid