I am trying to import rpy into python. I keep getting this error.
Traceback (most recent call last):
File "<pyshell#0>", line 1, in module
import rpy
File "E:\Python26\lib\site-packages\rpy.py", line 58, in module
RVERSION = rpy_tools.get_R_VERSION(RHOME)
File "E:\Python26\lib\site-packages\rpy_tools.py", line 103, in get_R_VERSION
raise RuntimeError("Couldn't obtain version number from output\n"
RuntimeError: Couldn't obtain version number from output
of `R --version'.
I looked on the forums and found the following thread with the same issue. Followed what someone recommend there and I still get the same error. I have Rpy 1.0.3, Python 2.6, R2.14 and Windows 7 x64. I also have numpy 1.6.1 and pywin32 build 216 per recommended by the rpy site for windows installs.
Importing rpy module into python
R is in the path and the same error still occurs.
Added the path to the x64 R.exe. Also went in like the above post and added the extra +'s. Still runs in Command line but now getting a new error.
Traceback (most recent call last):
File "", line 1, in
import rpy
File "E:\Python26\Lib\site-packages\rpy.py", line 101, in
raise RuntimeError("Unable to locate R.dll within %s" % RHOME)
RuntimeError: Unable to locate R.dll within C:\Program Files\R\R-2.14.0
Going to search Stack for other errors witl the R.dll. Seems there are 2 R.dll's too. one in i386 and one in x64.
Found in rpy.py
if sys.platform=='win32': import win32api os.environ['PATH'] += ';' + os.path.join(RHOME,'bin')
So I added in after 'bin' a 'i386','x64','R.dll'. Still the same error even after I tell it where to look. Found some stuff on editing the "rinterface/init.py" but I can't find this file. Granted that was for rpy2 that seems to be running into the same problem.
Well not sure what I changed but now I am getting the following
Traceback (most recent call last):
File "", line 1, in
import rpy
File "E:\Python26\lib\site-packages\rpy.py", line 106, in
win32api.LoadLibrary( Rlib )
error: (126, 'LoadLibrary', 'The specified module could not be found.')
Tried it in x64 mode. Got an error that loadlibrary cant work in x64 as it is a win32 module. Went back to i386 and thus got an error saying rpy wont work with R2.14.0. Going to try a old version of R.
Upon further review I am an idiot. I downloaded rpy2 made the same following changes and it works like a charm.