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

匿名 (未验证) 提交于 2019-12-03 01:12:01

问题:

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?

回答1:

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.



回答2:

1.use easy_install rpy2 and it works just fine.

http://rpy.sourceforge.net/rpy2/doc-2.2/html/overview.html#download

Make sure you have set_up tools installed. If you do not know how to do that,check the link below.

https://pypi.python.org/pypi/setuptools#windows

You can just run ez_setup.py and let it decide for you.

2.Add C:\Program Files\R\R-2.12.1\bin\i386 (the path to R.dll) to the environment variable PATH 3.Add an environment variable R_HOME with C:\Program Files\R\R-2.12.1 4.Add an environment variable R_USER with your Windows username



回答3:

Installation worked for me when I did

pip install rpy2

but not when I did

sudo pip install rpy2

So in case you were using sudo and not mentioning it, this might help you. I also tried manually installing from source, which worked when I used just 'python setup.py install' for the install step, but not with sudo!

I did this on CentOS 7 with Python 2.7 and R 3.2 (as the root user). On sudo's behavior, see this question.



回答4:

I had the same problem (on a Mac) and none of the solutions I found online worked. The only thing that worked for me was:

conda update python

pip install rpy2



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!