I\'m trying to install rpy2 on my computer, but I wasn\'t able to do it.
I downloaded the source package and I tryed to install Rpy2 (rpy2-2.3.2) using the command <
The install script setup.py
is telling that a problem was met when running
"C:\PROGRA~1\R\R-215~1.2\bin\R" CMD config --ldflags
Open a terminal, paste that command, check what the error is.
As you edited the question with the output the problem seems to be that while running that command as a subprocess from python setup.py install
an empty string is returned while when running the command from a terminal there is an output.
I am also reading from the output from the terminal that cygwin is involved. May be this is the problem ?
Following the answers above, this is what works for me
System: Win 7-64, Python 3.6,
R_HOME
and R_USER
, as environment variableR_HOME = D:\Program Files\R\R-3.4.1
R_USER = Administrator
The user name can be obtained by echo %username%
in cmd
rpy2
and install itDownload rpy2 from http://www.lfd.uci.edu/~gohlke/pythonlibs/
Check to its path, and install it in cmd like pip install rpy2-2.8.6-cp36-cp36m-win_amd64.whl
import rpy2.robjects as robjects
# test : evaluating R code
robjects.r('''
# create a function `f`
f <- function(r, verbose=FALSE) {
if (verbose) {
cat("I am calling f().\n")
}
2 * pi * r
}
# call the function `f` with argument value 3
f(3)
''')
I also generally had no success getting Rpy2 to work on Windows. After a few hours hacking around with R2.15 and Rpy2 from the pre-compiled binary 2.3.4.win-amd64-py2.7, I followed this question, and installed pyper instead. Maybe this will work for you until the support is there. I for one would love to see Rpy2 on Windows and IPython notebook (%load_ext rmagic), but I just couldn't spend any more time with it.