1

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

after runing [ rpy2-2.5.6]$ python setup.py install commands in my redhat server

NorthCat
  • 9,643
  • 16
  • 47
  • 50
user3134318
  • 19
  • 1
  • 2
  • Welcome to StackOverflow. Can you give us more details please ? – jmgross Apr 20 '15 at 07:10
  • I am trying to install rpy2-2.5.6 in my server ( redhat ). According to installation guideline when I execute "python setup.py install" commands it returns "Error: Tried to guess R's HOME but no R command in the PATH". How can I overcome this problem – user3134318 Apr 20 '15 at 07:28
  • 1
    possible duplicate of [trouble installing rpy2 on win7 (R 2.12, Python 2.5)](http://stackoverflow.com/questions/4924917/trouble-installing-rpy2-on-win7-r-2-12-python-2-5) – Eilidh Apr 20 '15 at 08:12
  • As the linked question describes, you need to set up your environment variable. http://www.mediacollege.com/linux/red-hat/path-variable.html – Eilidh Apr 20 '15 at 08:14
  • I have added the R path "/usr/lib64/R" in .bashrc file but didn't solve my problem – user3134318 Apr 21 '15 at 07:38

3 Answers3

2

Try to install libraries always with pip instead of messing around yourself with setup.py files.

I run into the same error under windows 8, R Version 3.3.1 and Python 2.7, 32bit. The solution is easy but for this case the normal pip install rpy2 does not work.

Instead try to use the Windows-Binaries you find them here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2. Download the suiting whl file for your configuration. Then go to your download folder in cmd and simply use:

pip install rpy2-2.7.8-cp27-none-win32.whl

Note, make sure you adapt this code to your download file.

Philipp Schwarz
  • 18,050
  • 5
  • 32
  • 36
0

I found out that this happens to me because I'm trying to install on a python version 2.6.5 and the setup.py script tries to use a method subprocess.check_output that is new on 2.7, hence it raises an exception that leads to the this message. It seems to be wise to use a 2.7 or later version, because the check_output method is used several times in the setup.py script.

loluengo
  • 76
  • 3
0

This worked for me on my Mac using python 2.7:
In my ~/.profile (or use ~/.bashrc) I set:

export R_HOME=/Library/Frameworks/R.framework/Versions/Current/Resources/
export PATH=$R_HOME:$PATH

sourced it (source ~/.profile) and then did the standard

pip install rpy2
elzurdo
  • 579
  • 1
  • 4
  • 14