KS15
KS15

Reputation: 1

installing rpy2 on R3.1.1 on Python 2.7.2 on Windows 7(R.dll not found)

I have been trying to learn Python and was working on a data that needed seasonal decomposition. So I had to use R for that since Python didn't allow me for it. Using Rpy2 was a good option to use for decomposing my data. Hence I went through all the stackoverflow query during the installation process, in order to troubleshoot the errors. I downloaded rpy2 from this link.

But then it showed errors about not finding R_HOME

So I defined my R_HOME as C:\Program Files\R\R-3.1.1 R_USER: PATH :C:\Program Files\R\R-3.1.1\bin\x64

I went through the following link: Bizzarre issue trying to make Rpy2 2.1.9 work with R 2.12.1, using Python 2.6 under Windows xp - Rpy can't find the R.dll?

I also made some changes to the file reinterface_init using the following link; but nothig has worked. I have removed the changes that I made to the code for now, as it did not help.

http://sourceforge.net/p/rpy/mailman/rpy-list/thread/[email protected]/

So now my error is:

RuntimeError                              Traceback (most recent call last)
<ipython-input-1-a95a8d7dbf95> in <module>()
      2 from numpy import asarray, ceil
      3 import pandas
----> 4 import rpy2.robjects as robjects

C:\Users\kalika.srivastava\AppData\Local\Enthought\Canopy\User\lib\site-packages\rpy2\robjects\__init__.py in <module>()
     13 import itertools
     14 from datetime import datetime
---> 15 import rpy2.rinterface as rinterface
     16 import rpy2.rlike.container as rlc
     17 

C:\Users\kalika.srivastava\AppData\Local\Enthought\Canopy\User\lib\site-packages\rpy2\rinterface\__init__.py in <module>()
     88     # Otherwise fail out!
     89     if not _win_ok:
---> 90         raise RuntimeError("Unable to locate R.dll within %s" % R_HOME)
     91 
     92 

I have been stuck on this for a while, and it will really help if any one has any suggestion to make.

Thanks!

Upvotes: 0

Views: 607

Answers (1)

chl111
chl111

Reputation: 488

rpy2 package will automatically dive into "bin" folder to call R.exe; however, the core R files are located one level below (64-bit: bin\x64 or 32-bit: bin\i386). For example, assuming you wish to use 64-bit R, to make RPY2 work properly, you need to make sure that you copy everything , except R.exe and Rscript.exe, from the x64 folder to the bin folder.

Upvotes: 1

Related Questions