Installing R in KNIME_2.11.2

Hello,

Operating System : Linux (CentOS 6.5 x64)

I installed the new version of Knime (2.11.2), and I would like to use the libraries coming from my R installation (/mnt/DATA/Install/R-3.1.1/bin/R).

I used your FAQ page entitled "The new interactive R integration does not recognize JRI library: org.rosuda.REngine.REngineException: Cannot load JRI native library" to integrate R in Knime.

I have installed the package rJava with the command (install.packages('rJava')) in my R installation and I can call it from the R gui.

I have changed R directory in KNIME under Preferences > KNIME > R (/mnt/DATA/Install/R-3.1.1/) and added the system property to my knime.ini (-Djava.library.path="/mnt/DATA/Install/R-3.1.1/library/rJava/jri/"). When I try to use R Snippet Node, I've got the error message : 

R cannot be initialized.
Cannot load jri library from any of following locations:
/mnt/DATA/Install/R-3.1.1/library/rJava/jri/libjri.so (not found)
/mnt/DATA/Install/R-3.1.1/library/rJava/jri/jri.so (not found)
Cannot load JRI native library

I checked the repository /rJava/jri/ but instead libjri.so and jri.so lib, I have  JRIEngine.jar and REngine.jar. I don't know how to solve this problem?

In the 2.9 version, we had the possibility to select the "Path to R excecutable" (/mnt/DATA/Install/R-3.1.1/bin/R), which worked very well.

Any help would be appreciated.

Baptiste

First, you don't need to set the java.library.path in the knime.ini. Second, if the jri.so or libjri.so are not present then probably rJava was not installed properly. Without one of these libraries the R nodes won't work. Can you check whether the libjri.so or jri.so are probably in some non-standard location?
 

There is this message from another thread. http://tech.knime.org/forum/r-statistics-nodes-and-integration/strange-error-from-r-interactive-nodes 15

As mentioned in #8 above, my $R_HOME/library/rJava/jri/ only contains the two archives JRIEngine.jar and REngine.jar, but no *.so or *.jnilib and no x64 subfolder. Within the rJava folder, I only found one *.so file, which is rJava.so inside the $R_HOME/library/rJava/libs/ folder. However, pointing the knime.ini to this path doesn't make any difference. Whenever I tried to run (or configure) an R node, I got an error that R could not be initialized.

The important point was that I compiled R from the sources! When installing rJava within R, I found the following log messages:

checking whether JRI should be compiled (autodetect)... no
...
checking whether JRI is requested... no

So I tried to explicitly request JRI using the following command:

> install.packages("rJava", configure.args=c("--enable-jri"))

which in turn required the R system to be build as a shared library:

$ ./configure --enable-R-shlib
$ make

Finally, after re-building R with "enable-R-shlib" option and subsequently installing rJava (which than automatically enabled jri), I got a "libjri.so" in the folder $R_HOME/library/rJava/jri/ to which I pointed the knime.ini, and Knime is able to initialize R 3.0.3.

Hope it helps,

Nicolas

Thanks a lot for your answers and thank you very much Nico1990 ... Your solution works perfectly well.

Regards,

Baptiste

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.