Hitachi Vantara Pentaho Community Forums
Results 1 to 8 of 8

Thread: R Weka integration errors

  1. #1
    Join Date
    Mar 2014
    Posts
    4

    Default R Weka integration errors

    Hi,

    I am getting the following errors when trying to run Weka 3.7.10 under Windows7 with R.3.0.2:

    ---Registering Weka Editors---
    Getting parent classloader....
    Injecting JRI classes into the root class loader...
    Windows 32 bit OS
    Trying R_LIBS_USER (C:/Users/user1/Documents/R/win-library/3.0)
    Found rJava installed in C:\Users\user1\Documents\R\win-library\3.0\rJava
    Trying to loaded R library from C:\Users\user1\Documents\R\win-library\3.0\rJava \jri\i386\jri.dll
    Engine class: class org.rosuda.JRI.Rengine ClassLoader:sun.misc.Launcher$ExtClas sLoader@1a1472d
    Unable to load R library from C:\Users\user1\Documents\R\win-library\3.0\rJava\j ri\i386\jri.dll: C:\Users\user1\Documents\R\win-library\3.0\rJava\jri\i386\jri.d ll: Can't find dependent libraries
    Getting REngine....
    Exception in thread "Thread-3" java.lang.UnsatisfiedLinkError: org.rosuda.JRI.Re ngine.rniSetupR([Ljava/lang/StringI
    org.rosuda.JRI.Rengine.rniSetupR(Native Method)
    org.rosuda.JRI.Rengine.setupR(Rengine.java:170)
    org.rosuda.JRI.Rengine.run(Rengine.java:635)

    at org.rosuda.JRI.Rengine.rniSetupR(Native Method)
    at org.rosuda.JRI.Rengine.setupR(Rengine.java:170)
    at org.rosuda.JRI.Rengine.run(Rengine.java:635)


    Loading freezes at this point.

    I have:
    R_LIBS_USER = C:/Users/user1/Documents/R/win-library/3.0
    PATH = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\R\R-3.0.2\bin;C:\Program Files\Calibre2\

    I would highly appreciate any help or suggestion.

  2. #2
    Join Date
    Aug 2006
    Posts
    1,741

    Default

    It doesn't look like you have the R_HOME environment variable set? This needs to point to the installation directory for R, so in your case:

    C:\Program Files\R\R-3.0.2

    Cheers,
    Mark.

  3. #3
    Join Date
    Mar 2014
    Posts
    4

    Default

    Dear Mark, thank you for the prompt reply.

    The R_HOME is set and points to C:\Program Files\R\R-3.0.2, as it should.
    Could there be some other reason?

    In case this helps: before I set the R_LIBS_USER (or if I delete it now) Weka was loading, however producing lots of errors in the console (please see below). But when I set the R_LIBS_USER = C:/Users/user1/Documents/R/win-library/3.0 the console produces the errors cited in my previous post and the Weka GUI choser window never appears.

    Below are error messages with R_LIBS_USER not set:
    user1@PC /cygdrive/c/Program Files/Weka-3-7 $ java -Xmx1000M -jar weka.jar
    user1@PC /cygdrive/c/Program Files/Weka-3-7
    $ java -Xmx1000M -jar weka.jar
    ---Registering Weka Editors---
    Getting parent classloader....
    Injecting JRI classes into the root class loader...
    Windows 32 bit OS
    Trying to load R library from java.library.path
    Engine class: class org.rosuda.JRI.Rengine ClassLoader:sun.misc.Launcher$ExtClassLoader@14d8a08
    java.lang.reflect.InvocationTargetException
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    weka.core.RSessionImpl.init(RSessionImpl.java:231)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    weka.core.JRILoader.load(JRILoader.java:89)
    weka.gui.explorer.ExplorerRConsolePanel.<clinit>(ExplorerRConsolePanel.java:47)
    java.lang.Class.forName0(Native Method)
    java.lang.Class.forName(Unknown Source)
    weka.core.ClassDiscovery.find(ClassDiscovery.java:343)
    weka.gui.GenericPropertiesCreator.generateOutputProperties(GenericPropertiesCreator.java:528)
    weka.gui.GenericPropertiesCreator.execute(GenericPropertiesCreator.java:620)
    weka.gui.GenericPropertiesCreator.<clinit>(GenericPropertiesCreator.java:162)
    weka.core.WekaPackageManager.processGenericPropertiesCreatorProps(WekaPackageManager.java:406)
    weka.core.WekaPackageManager.loadPackages(WekaPackageManager.java:881)
    weka.core.WekaPackageManager.loadPackages(WekaPackageManager.java:817)
    weka.gui.GenericObjectEditor.determineClasses(GenericObjectEditor.java:174)
    weka.gui.GenericObjectEditor.<clinit>(GenericObjectEditor.java:248)
    weka.gui.GUIChooser.<init>(GUIChooser.java:707)
    weka.gui.GUIChooser.createSingleton(GUIChooser.java:259)
    weka.gui.GUIChooser.main(GUIChooser.java:1558)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at weka.core.RSessionImpl.init(RSessionImpl.java:231)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at weka.core.JRILoader.load(JRILoader.java:89)
    at weka.gui.explorer.ExplorerRConsolePanel.<clinit>(ExplorerRConsolePanel.java:47)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at weka.core.ClassDiscovery.find(ClassDiscovery.java:343)
    at weka.gui.GenericPropertiesCreator.generateOutputProperties(GenericPropertiesCreator.java:528)
    at weka.gui.GenericPropertiesCreator.execute(GenericPropertiesCreator.java:620)
    at weka.gui.GenericPropertiesCreator.<clinit>(GenericPropertiesCreator.java:162)
    at weka.core.WekaPackageManager.processGenericPropertiesCreatorProps(WekaPackageManager.java:406)
    at weka.core.WekaPackageManager.loadPackages(WekaPackageManager.java:881)
    at weka.core.WekaPackageManager.loadPackages(WekaPackageManager.java:817)
    at weka.gui.GenericObjectEditor.determineClasses(GenericObjectEditor.java:174)
    at weka.gui.GenericObjectEditor.<clinit>(GenericObjectEditor.java:248)
    at weka.gui.GUIChooser.<init>(GUIChooser.java:707)
    at weka.gui.GUIChooser.createSingleton(GUIChooser.java:259)
    at weka.gui.GUIChooser.main(GUIChooser.java:1558)
    Caused by: java.lang.UnsatisfiedLinkError: no jri in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at weka.core.JRINativeLoader.loadLibrary(JRINativeLoader.java:58)
    ... 25 more
    Trying to add database driver (JDBC): RmiJdbc.RJDriver - Warning, not in CLASSPATH?
    Trying to add database driver (JDBC): jdbc.idbDriver - Warning, not in CLASSPATH?
    Trying to add database driver (JDBC): org.gjt.mm.mysql.Driver - Warning, not in CLASSPATH?
    Trying to add database driver (JDBC): com.mckoi.JDBCDriver - Warning, not in CLASSPATH?
    Trying to add database driver (JDBC): org.hsqldb.jdbcDriver - Warning, not in CLASSPATH?
    Refreshing GOE props...
    [KnowledgeFlow] Loading properties and plugins...
    [KnowledgeFlow] Initializing KF...

  4. #4
    Join Date
    Mar 2014
    Posts
    4

    Default

    Mark,
    things have improved when I added the path to R.dll (not only to R executable) to the PATH, which now reads:

    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\R\R-3.0.3\bin;C:\Program Files\R\R-3.0.3\bin\i386;C:\Program Files\Calibre2\

    (note the appearance of C:\Program Files\R\R-3.0.3\bin\i386; also, I updated R in the meanwhile, but that by itself did not improve anything).

    Weka seems to load normally now, though I haven't made any Rplugin checks.
    Once again, thank you for your help.

  5. #5
    Join Date
    Aug 2006
    Posts
    1,741

    Default

    Hmm. Interesting. Thanks for the info. When you installed R, did it ask you whether you wanted both 32 and 64 bit versions installed? I'm wondering if perhaps there is some difference in where dlls are placed in a 32 bit installation. To be honest, I've only tested on 64 bit Windows with 64 bit R.

    Cheers,
    Mark.

  6. #6
    Join Date
    Mar 2014
    Posts
    4

    Default

    CORRECTION:
    I checked on a new R installation. Yes, it does ask whether to install both 32 and 64 bit versions, or 32 bit only. I don't know whether dlls are placed differently in these cases.

    Hi Mark,
    Quote Originally Posted by Mark View Post
    Thanks for the info. When you installed R, did it ask you whether you wanted both 32 and 64 bit versions installed?
    No, there was no such dialog, as far as I can remember now. There was certainly none when upgrading R.3.0.2 to 3.0.3 yesterday (I did it by installing new version above the old one), and I am almost (but only almost) sure about the original installation, too.

    Regards,
    Alex
    Last edited by AlexD; 03-25-2014 at 12:58 AM.

  7. #7
    Join Date
    Jun 2014
    Posts
    1

    Default

    I was fight this a lot as well - here is final solution (Weka 3.7.11 - Win x64, R x64, JAVA x64):

    1) Have uninstalled my R (3.0.2) and reinstalled from scratch newest R x64 (3.1.0) - this is probably not needed -> but I wanted to have path set ok - I did install only x64 part of R
    2) set R_HOME env. variable to point to root of your R installation
    3) reinstall rJava in R install.packages("rJava")
    4) make sure your JVM is x64 (do java -version) in command line -> if you do not get x64 JVM -> you have mix-up in path / JAVA_HOME settings ...
    5) set PATH env variable to contain subfolders of R_HOME: bin; bin\x64; library\rJava\jri; library\rJava\jri\x64;

    (I put it on beginning of my PATH - in addition I checked all C:\Program Files\... and similiar entries in path list to make sure they are in quotes - "C:\Program Files\..." ):

    PATH=%R_HOME%\bin;%R_HOME%\bin\x64;%R_HOME%\library\rJava\jri;%R_HOME%\library\rJava\jri\x64;%PATH%

    6) Now I had to test JRI -> there is a test program run.bat in %R_HOME%\library\rJava\jri - I had to change the run.bat program as it contained wrong paths, my run.bat is:

    java -cp .;examples;JRI.jar;src/JRI.jar rtest $*

    7) If you now run run.bat in jri directory-> you will get an error:

    Cannot find JRI native library!
    Please make sure that the JRI native library is in a directory listed in java.library.path.


    java.lang.UnsatisfiedLinkError: .....\library\rJava\jri\jri.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1880)
    at java.lang.Runtime.loadLibrary0(Runtime.java:849)
    at java.lang.System.loadLibrary(System.java:1088)
    at org.rosuda.JRI.Rengine.<clinit>(Rengine.java:19)
    at rtest.main(rtest.java:61)


    That error looks familiar - huh ... ?? This is what is Weka giving me during start:
    ....
    Injecting JRI classes into the root class loader...
    Trying to load R library from java.library.path
    Engine class: class org.rosuda.JRI.Rengine ClassLoader:sun.misc.Launcher$ExtClassLoader@3c291fc2
    java.lang.reflect.InvocationTargetException
    ....

    8) Fooling around I just tried to replace the file jri.dll in directory %R_HOME\library\rJava\jri\ with jri.dll file which is in directory %R_HOME\library\rJava\jri\x64
    ... THAT DID THE WHOLE TRICK !!

    9) Now running run.bat - gives me no error

    10) Now when running Weka - no more exception.
    Though the start of Weka sometimes takes a while ...

  8. #8
    Join Date
    May 2012
    Posts
    11

    Red face Resolved...

    Hi,
    In Windows 7(x64) operating system, used CLASSPATH, is not being used PATH. "PATH" name is used on Windows 10. In windows 7, Enter a new variable named PATH. Enter the value "C: \ Program Files \ R \ R-3.4.2 \ bin \ x64" in the PATH variable. I'm working on this issue for three days. I solved the problem.


    Everyone greetings from Turkey.
    Last edited by erkan; 10-17-2017 at 07:34 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2017 Pentaho Corporation. All Rights Reserved.