"(RapidMiner - 5.1.11) (R - 2.13.1) Installation Problem - Mac OSX Lion (SOLVED)"

leiterenato
leiterenato New Altair Community Member
edited November 5 in Community Q&A
Hi Experts,

I know that it's not a good practice to repeat a topic in a FORUM, but I just gave up trying to make RapidMiner + R extension work. =(
So, here is the deal:

Operational System and Hardware
- Mac OSX Lion (10.7.1)
- Core i5

Software Versions (all 64 bits)
RapidMiner - v5.1.11
R - v2.13.1
Java - v1.6.0_26

Environment Variables

echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Library/Frameworks/R.framework/Libraries/x86_64
==> Here I can have access to libR.dylib in the PATH. Follows the files that I can see:
ls /Library/Frameworks/R.framework/Libraries/x86_64
libR.dylib libRblas.dylib libRlapack.dylib

echo $R_HOME
/Library/Frameworks/R.framework/Versions/2.13/Resources
==> In this folder I have access to R executables and some other R installation folders. Follow the output of a ls command:
ls /Library/Frameworks/R.framework/Versions/2.13/Resources
COPYING NEWS.pdf SVN-REVISION etc lib modules
Info.plist R bin fontconfig library share
NEWS Rscript doc include man1

echo $JAVA_HOME
/Library/Java/Home
==> Java installation folder. Follow the output of a ls command:
ls /Library/Java/Home
bin bundle lib man

To create this environment variables I used a .plist file (~/.MacOSX/environment.plist) like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>JAVA_HOME</key>
<string>/Library/Java/Home</string>
<key>R_HOME</key>
<string>/Library/Frameworks/R.framework/Versions/2.13/Resources</string>
<key>PATH</key>
<string>/Library/Frameworks/R.framework/Libraries/x86_64</string>
</dict>
</plist>

So, everytime I power on my laptop, open a terminal and type "env" all the environment variables are there.
After preparing the environment, I unziped the folder "rapidminer" and tried to start it in the following way:

TERMINAL
$java -jar lib/rapidminer.jar

Follows the main messages:
Sep 14, 2011 10:08:18 PM org.rosuda.JRI.Rengine loadLibrary
INFO: Successfully loaded R library from /Library/Frameworks/R.framework/Versions/2.13/Resources/library/rJava/jri/libjri.jnilib(true)
...
[Fatal Error] :1:1: Content is not allowed in prolog.
...
Sep 14, 2011 10:08:21 PM com.rapidminer.operator.r.ROperatorFactory readROperatorFragments
WARNING: Could not read R fragments from 'file:/Users/leiterenato/Documents/Projetos/Analytic/System/Tools/Rapid-i/rapidminer/lib/', error: Content is not allowed in prolog.
org.xml.sax.SAXParseException: Content is not allowed in prolog.
[Fatal Error] :1:1: Content is not allowed in prolog.
...
[Fatal Error] connections.xml:1:1: Premature end of file.
Sep 14, 2011 10:08:21 PM com.rapidminer.tools.jdbc.connection.DatabaseConnectionService init
WARNING: Failed to read database connections file: org.xml.sax.SAXParseException: Premature end of file.
org.xml.sax.SAXParseException: Premature end of file.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:208)
at com.rapidminer.io.process.XMLTools.parse(XMLTools.java:179)
at com.rapidminer.tools.jdbc.connection.DatabaseConnectionService.init(DatabaseConnectionService.java:92)
at com.rapidminer.RapidMiner.init(RapidMiner.java:474)
at com.rapidminer.gui.RapidMinerGUI.run(RapidMinerGUI.java:221)
at com.rapidminer.gui.RapidMinerGUI.launch(RapidMinerGUI.java:505)
at com.rapidminer.gui.RapidMinerGUI.main(RapidMinerGUI.java:488)
ARGUMENT 'LANGUAGE=en' __ignored__

==> Here the RAPID|MINER starter screen freezes. I have to force quit the app!
- What is this "prolog" error? Something related to permission on the folder?
- I also did a CHMOD 750 rapidminer.jar.

I think I read all the topics about this and tried to implement other solutions.
None of them seamed to work. =(
If I don't install R extension, everything works perfectly!

Does anyone have any clue about what is going on?

Thanks in advance!
Best Regards,
Renato

Answers

  • leiterenato
    leiterenato New Altair Community Member
    Hi Guys,

    I figured out how to make the R Extension (v2.13.1 - last version) work with RapidMiner (v5.1.11 - last version) in MacOSX Lion (10.7.1)!
    After trying several solutions, I mixed some ideas from other posts to solve this problem.

    Operational System and Hardware
    - Mac OSX Lion (10.7.1)
    - Core i5
    - MacBook Air 13" and MacMini Server

    Software Versions (all 64 bits)
    RapidMiner - v5.1.11
    R - v2.13.1
    Java - v1.6.0_26
    MySQL - 5.5.16

    Installation Process

    1) Install MySQL - v5.5.16 (this is not necessary to make R Extension work)
    - MySQL (www.mysql.com)

    2) Install R - v2.13.1
    - R (http://cran.r-project.org)

    3) Install TclTk Package from R website
    - TclTk (http://cran.r-project.org/bin/macosx/tools/)

    ==> You MUST do this. The missing of this package was the reason I wasn't able to start RapidMiner.

    4) Install R Packages. Open R command line and type the following commands to install each package.

    install.packages("rJava")
    # You MUST install this package.
    install.packages("JavaGD")
    # The package JavaGD enables R Extension to plot graphics. Without this you get an error when trying to plot stuff.
    install.packages("RMySQL")
    # This package is very useful to connect to MySQL databases.

    5) Environment Variables

    I tried at least 6 different solutions (.bashrc, .profiles, .plist, export, setenv, etc...)! I found a good solution that you simply don't have to dirty your SO with files or repeat commands in a terminal.  
    Just an observation ... When I tried to create a .plist file (~/.MacOSX/environment.plist) the variables were exported but it BLOCKS that folder or file to be accessed from any program.

    The solution is the EXPORT commands! (yes, that's true).

    But to avoid the need to open a terminal and export the variables everytime you want to execute RapidMiner, let's use the app Automator (native in any Mac OSX Lion to create a program). Very Simple...

    - Open Automator.app
    - Choose to create an "Application"
    - On the left most column, choose "Utilities" (a sub item from Library)
    - On the second column, choose "Run Shell Script"
    - Double click on it
    - In the window that appears, choose (on the left) "shell : /bin/bash" and on the right "Pass input: as arguments"
    - Paste the following in the text area:
    export PATH=$PATH:/Library/Frameworks/R.framework/Versions/2.13/Resources/bin:/Library/Frameworks/R.framework/Versions/2.13/Resources/library/rJava/jri:/Library/Frameworks/R.framework/Libraries/x86_64
    export R_HOME=/Library/Frameworks/R.framework/Resources (this is where your R is installed)
    export RAPIDMINER_HOME=/subfolders_where_is_rapidminer/rapidminer (exemple: /Users/foo/rapidminer)
    export JAVA_HOME=/subfolder_where_is_your_JAVA_HOME (exemple:/Library/Java/Home)
    cd /subfolders_where_is_rapidminer/rapidminer/lib
    java -jar rapidminer.jar

    ==> In the PATH variable I put the path to:
    .bin files or R (/Library/Frameworks/R.framework/Versions/2.13/Resources/bin)
    .JRI library files (/Library/Frameworks/R.framework/Versions/2.13/Resources/library/rJava/jri)
    .R Library files 64 bits (/Library/Frameworks/R.framework/Libraries/x86_64)

    - Save as: name_choosen_by_you
    with, file format: application.

    DONE: In this way you have a clean solution to execute your RapidMiner.

    I tested this solution in my MacBook Air and MacMini Server and worked fine.

    !!!ATTENTION PLEASE!!!
    After installing RapidMiner with R extension I tried to run the same export commands directly into TERMINAL to see if there are any other WARNINGs.
    ==> Please, after installing your RapidMiner and R Extension, help me figure out these other WARNINGs (I created another post for this)...

    http://rapid-i.com/rapidforum/index.php/topic,4138.0.html

    I really appreciate if anyone from Development Team translate the WARNINGs for us. =)

    Please, feedbacks are very important!

    Thank you all.
    Renato Leite