-->

“Error: Tried to guess R's HOME but no R comma

2019-06-03 08:31发布

问题:

"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

回答1:

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.



回答2:

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.



回答3:

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


标签: rpy2