Rscript gives rise to Process Failed
Dear all,
I have installed R extension in my rapidminer, but when I try to run a simple example code I recieve "Process failed. Script terminated abnormaly" error message.
This is the log from pop-up window:
- Exception: com.rapidminer.operator.OperatorException
- Message: Script terminated abnormally.
- Stack trace:
- com.rapidminer.operator.scripting.AbstractScriptRunner.run(AbstractScriptRunner.java:162)
- com.rapidminer.operator.scripting.AbstractScriptingLanguageOperator.doWork(AbstractScriptingLanguageOperator.java:90)
- com.rapidminer.operator.scripting.r.RScriptingOperator.doWork(RScriptingOperator.java:73)
- com.rapidminer.operator.Operator.execute(Operator.java:1002)
- com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:50)
- com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:798)
- com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:392)
- com.rapidminer.operator.Operator.execute(Operator.java:1002)
- com.rapidminer.Process.run(Process.java:1071)
- com.rapidminer.Process.run(Process.java:973)
- com.rapidminer.Process.run(Process.java:926)
- com.rapidminer.Process.run(Process.java:921)
- com.rapidminer.Process.run(Process.java:911)
- com.rapidminer.gui.ProcessThread.run(ProcessThread.java:65)
I have RM 32 bit, R-3-1-2 (32 bit) and the java path also refers to 32 bit av java.
JAVA_HOME= C:\Program Files (x86)\RapidMiner\RapidMiner Studio\jre
R_HOME= C:\Program Files\R\R-3.1.2\bin\i386
I get the same error with
JAVA_HOME= C:\Program Files (x86)\Java\jre1.8.0_91\
I appreciate your help.
Mahdi
Best Answer
-
Thomas_Ott RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,761 Unicorn
You will get an error if you do a simple script like this:
cars <- c(1, 3, 6, 4, 9)
print(cars)You have to embed your script between the {....} brackets and call it as a function. Like this:
# rm_main is a mandatory function,
# the number of arguments has to be the number of input ports (can be none)
rm_main = function(data)
{
print('Hello, world!')
# output can be found in Log View
print(str(data))
# your code goes here
# for example:
data2 <- as.data.table(matrix(1:16,4,4))
# connect 2 output ports to see the results
return(list(data,data2))
}Did you try testing the pre-loaded R Scripting examples? Just right click on the R Script Operator and click on "Jump to Tutorials." Load one up and run it, if it still crashes then there's another problem.
0
Answers
I think you might need to install the rJava R package. You also have to install the data.table package.
i.e. do the following from the R command prompt
These errors look related to the old R Extension , especially if you had to set the R path in your environment variables. Can you confirm?
We've since updated our R extension to the "R Scripting" extension. It's easier to use now and all that it requires, as Andrew pointed out, is the Data Tables pacakge to run. The installation is really simple, you just need to point to your R executable location. Please note, Studio, Windows, and R need to all be the same bit architecture.
I reinstalled the R Scripting extension and updated my R software to R.3.3.1.
Then installed some packages from R side as following: (From binary packages)
> install.packages('C:\\Mahdi\\Downloads\\data.table_1.9.6.zip', repos = NULL)
package ‘data.table’ successfully unpacked and MD5 sums checked
> install.packages('C:\\Mahdi\\Downloads\\rJava_0.9-8.zip', repos = NULL)
package ‘rJava’ successfully unpacked and MD5 sums checked
>
> library(data.table)
data.table 1.9.6 For help type ?data.table or https://github.com/Rdatatable/data.table/wiki
The fastest way to learn (by data.table authors): https://www.datacamp.com/courses/data-analysis-the-data-table-way
> library(rJava)
With and without the ENV variable ( R_HOME and JAVA_HOME) I ran an example of R script. But unfortunately the problem persists!
My machine is 64 bit, but the Rapidminer and R version that are called via Rapidminer are 32 bit!
Thanks for the help.
Mahdi
I made all the Studio, Windows and R 64 bit structure. It did not still help!
Mahdi
Hello
Just checking but did you use the example R script as supplied with RapidMiner Studio?
regards
Andrew
The installation of the data.tables package can be automatically handled through the preferences. That said, did you go to Tools > Preferences and set your R executable path there?
The fact that you're still setting the R_HOME variable makes me suspect that either you're using the old extension or the new extension and trying to config it in the old way.
The R Scripting extension is super simple to install now. Just download the extension. go to Tools > Preferences, select the Rscript.ext path and it should be done. If it can't find data.tables, it will ask to download it too.
Note: You should be using at a minimum Studio version 6.4
No, I did not use the one which is supplied by the R Operation. I use something simple like this:
cars <- c(1, 3, 6, 4, 9)
print(cars)
I use the newest version of the studio.
I do configure the R_HOME correctly to match the same version as I call via Tools > Preferences ....
By the was, I removed the R_HOME from path and ran set in the cmd to make sure that it is removed, then initiate the Rapidminer, but still get the same error message.
Mahdi
Actually the problem was not to configure my installation with the resources. I had not noticed that
rm_main = function(data){ }
has to be in fact frame of my code.
Thank you so much!
Mahdi
Wonderful news! Good luck and happy RapidMining!