Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error in installing rpy2 on windows

Tags:

rpy2

I am trying to install rpy2 package and getting following error both with

C:\python27>easy_install rpy2

Searching for rpy2
Reading http://pypi.python.org/simple/rpy2/
Reading http://rpy.sourceforge.net
Best match: rpy2 2.3.3
Downloading http://pypi.python.org/packages/source/r/rpy2/rpy2-2.3.3.tar.gz#md5=6cd95eb70645577cb53198ef0a32395e
Processing rpy2-2.3.3.tar.gz
Running rpy2-2.3.3\setup.py -q bdist_egg --dist-dir c:\users\chetan~1\appdata\local\temp\easy_install-wfxip9\rpy2-2.3.3\egg-di
st-tmp-rrezfb
"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags
Invalid substring

in string

C:\Python27\lib\site-packages\setuptools\command\easy_install.py:921: RuntimeWarning: tp_compare didn't return -1 or -2 for ex
ception
  raise DistutilsError("Setup script exited with %s" % (v.args[0],))
error: Setup script exited with Problem while running `"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags`

And when I try pip this is what I get

c:\Python27\Lib\site-packages\django\bin>pip install rpy2

Downloading/unpacking rpy2 Running setup.py egg_info for package rpy2

"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags
Invalid substring

in string

Problem while running `"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags`
like image 660
user2151600 Avatar asked Mar 09 '13 13:03

user2151600


People also ask

How do I install rpy2 on Windows?

Open a cmd window (as Administrator) in the . whl's download dir. Set R_USER env var to current username: set R_USER=%USERNAME% python -m pip install rpy2‑2.9.

Do I need to install R for rpy2?

Installing rpy2You must have Python >=3.7 and R >= 4.0 installed to use rpy2 3.5.

Is rpy2 discontinued?

Rpy2 (discontinued, unstable): provide access to the R software environment for statistical computing and graphics.

What version of R does rpy2 use?

rpy2 will typically require an R version that is not much older than itself. This means that even if your system has R pre-installed, there is a chance that the version is too old to be compaible with rpy2. At the time of this writing, the latest rpy2 version is 2.8 and requires R 3.2 or higher.


1 Answers

I spent a few days on this too... then I stumbled upon this thread, where a link is given: http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2

On this page you can find (amongst other useful things) a pre-compiled version of rpy2 for Windows, and for different versions of Python. It apparently only works for R 2.15.3, I did not try it with other versions.

like image 123
Bertrand Moreau Avatar answered Sep 23 '22 01:09

Bertrand Moreau