R View (Table), R View (Workspace) fail, but R Snippet works

Hi, Dear KNIMEer,

I have dig the forum, find nothing related. And I also check the R install doc

I use KNIME 4.4.1 on Mac, R extension is also the latest. I use latest miniconda to install R. And install package like this: conda create -n r_knime -c conda-forge r-essentials r-base r-rserve r-cairo. So the packages version are almost latest, I believe.

In KNIME, R SnippetTable to R nodes work, so I believe the rserve related thing is ok.

After that, I suspect the problem is about xquartz, but when I try R in cmd line, it works:

cars <- c(1, 3, 6, 4, 9)
plot(cars)

Here is the knime.log:

2021-10-11 23:44:55,319 : ERROR : KNIME-Worker-43-R View (Table) 0:3 :  : Node : R View (Table) : 0:3 : Execute failed: R evaluation failed.: "knime.tmp.ret<-NULL;printError<-function(e) message(paste('Error:',conditionMessage(e)));for(exp in tryCatch(parse(text=knime.t
mp.script),error=printError)){tryCatch(knime.tmp.ret<-withVisible(eval(exp)),error=printError)
if(!is.null(knime.tmp.ret)) {if(knime.tmp.ret$visible) tryCatch(print(knime.tmp.ret$value),error=printError)}};rm(knime.tmp.script,exp,printError);knime.tmp.ret$value"
org.knime.r.controller.IRController$RException: R evaluation failed.: "knime.tmp.ret<-NULL;printError<-function(e) message(paste('Error:',conditionMessage(e)));for(exp in tryCatch(parse(text=knime.tmp.script),error=printError)){tryCatch(knime.tmp.ret<-withVisible(eval(e
xp)),error=printError)
if(!is.null(knime.tmp.ret)) {if(knime.tmp.ret$visible) tryCatch(print(knime.tmp.ret$value),error=printError)}};rm(knime.tmp.script,exp,printError);knime.tmp.ret$value"
        at org.knime.r.controller.RController.monitoredEval(RController.java:406)
        at org.knime.r.controller.ConsoleLikeRExecutor.executeIgnoreResult(ConsoleLikeRExecutor.java:247)
        at org.knime.r.RSnippetNodeModel.runRScript(RSnippetNodeModel.java:294)
        at org.knime.r.RSnippetNodeModel.executeSnippet(RSnippetNodeModel.java:244)
        at org.knime.r.RSnippetNodeModel.executeSnippet(RSnippetNodeModel.java:208)
        at org.knime.r.RSnippetNodeModel.executeInternal(RSnippetNodeModel.java:166)
        at org.knime.r.RSnippetNodeModel.execute(RSnippetNodeModel.java:154)
        at org.knime.r.RViewNodeModel.execute(RViewNodeModel.java:108)
        at org.knime.core.node.NodeModel.executeModel(NodeModel.java:556)
        at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1259)
        at org.knime.core.node.Node.execute(Node.java:1039)
        at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:559)
        at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:95)
        at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:201)
        at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:117)
        at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:365)
        at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:219)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:123)
        at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:246)
Caused by: org.knime.r.controller.IRController$RException: R evaluation failed.: "knime.tmp.ret<-NULL;printError<-function(e) message(paste('Error:',conditionMessage(e)));for(exp in tryCatch(parse(text=knime.tmp.script),error=printError)){tryCatch(knime.tmp.ret<-withVisible(eval(exp)),error=printError)
if(!is.null(knime.tmp.ret)) {if(knime.tmp.ret$visible) tryCatch(print(knime.tmp.ret$value),error=printError)}};rm(knime.tmp.script,exp,printError);knime.tmp.ret$value"
        at org.knime.r.controller.RController.eval(RController.java:395)
        at org.knime.r.controller.RController$MonitoredEval.lambda$0(RController.java:1427)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at org.knime.core.util.ThreadUtils$3.runWithContext(ThreadUtils.java:523)
        at org.knime.core.util.ThreadUtils$ThreadWithContext.run(ThreadUtils.java:338)
Caused by: org.rosuda.REngine.Rserve.RserveException: voidEval failed
        at org.rosuda.REngine.Rserve.RConnection.voidEval(RConnection.java:182)
        at org.knime.r.controller.RController.eval(RController.java:390)
        ... 4 more
2021-10-11 23:44:56,505 : ERROR : KNIME-Worker-47-R View (Workspace) 0:4 :  : Node : R View (Workspace) : 0:4 : Execute failed: R evaluation failed.: "knime.tmp.ret<-NULL;printError<-function(e) message(paste('Error:',conditionMessage(e)));for(exp in tryCatch(parse(text=knime.tmp.script),error=printError)){tryCatch(knime.tmp.ret<-withVisible(eval(exp)),error=printError)
if(!is.null(knime.tmp.ret)) {if(knime.tmp.ret$visible) tryCatch(print(knime.tmp.ret$value),error=printError)}};rm(knime.tmp.script,exp,printError);knime.tmp.ret$value"
org.knime.r.controller.IRController$RException: R evaluation failed.: "knime.tmp.ret<-NULL;printError<-function(e) message(paste('Error:',conditionMessage(e)));for(exp in tryCatch(parse(text=knime.tmp.script),error=printError)){tryCatch(knime.tmp.ret<-withVisible(eval(exp)),error=printError)
if(!is.null(knime.tmp.ret)) {if(knime.tmp.ret$visible) tryCatch(print(knime.tmp.ret$value),error=printError)}};rm(knime.tmp.script,exp,printError);knime.tmp.ret$value"
        at org.knime.r.controller.RController.monitoredEval(RController.java:406)
        at org.knime.r.controller.ConsoleLikeRExecutor.executeIgnoreResult(ConsoleLikeRExecutor.java:247)
        at org.knime.r.RSnippetNodeModel.runRScript(RSnippetNodeModel.java:294)
        at org.knime.r.RSnippetNodeModel.executeSnippet(RSnippetNodeModel.java:244)
        at org.knime.r.RSnippetNodeModel.executeSnippet(RSnippetNodeModel.java:208)
        at org.knime.r.RSnippetNodeModel.executeInternal(RSnippetNodeModel.java:166)
        at org.knime.r.RSnippetNodeModel.execute(RSnippetNodeModel.java:154)
        at org.knime.r.RViewNodeModel.execute(RViewNodeModel.java:108)
        at org.knime.core.node.NodeModel.executeModel(NodeModel.java:556)
        at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1259)
        at org.knime.core.node.Node.execute(Node.java:1039)
        at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:559)
        at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:95)
        at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:201)
        at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:117)
        at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:365)
        at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:219)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:123)
        at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:246)
Caused by: org.knime.r.controller.IRController$RException: R evaluation failed.: "knime.tmp.ret<-NULL;printError<-function(e) message(paste('Error:',conditionMessage(e)));for(exp in tryCatch(parse(text=knime.tmp.script),error=printError)){tryCatch(knime.tmp.ret<-withVis
ible(eval(exp)),error=printError)
if(!is.null(knime.tmp.ret)) {if(knime.tmp.ret$visible) tryCatch(print(knime.tmp.ret$value),error=printError)}};rm(knime.tmp.script,exp,printError);knime.tmp.ret$value"
        at org.knime.r.controller.RController.eval(RController.java:395)
        at org.knime.r.controller.RController$MonitoredEval.lambda$0(RController.java:1427)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at org.knime.core.util.ThreadUtils$3.runWithContext(ThreadUtils.java:523)
        at org.knime.core.util.ThreadUtils$ThreadWithContext.run(ThreadUtils.java:338)
Caused by: org.rosuda.REngine.Rserve.RserveException: voidEval failed
        at org.rosuda.REngine.Rserve.RConnection.voidEval(RConnection.java:182)
        at org.knime.r.controller.RController.eval(RController.java:390)
        ... 4 more

I suspect there is a bug, but I don’t have the ability to dig more.

Any suggestion?

Thanks!

I use Conda Environment Propagation node to handle the environment, here is the workflow:
knime_r.knwf (762.9 KB)

I also read a post about to use regular R instead of anaconda, but I believe that is not the key to this specific problem.

@mlauber71 Sorry to disturb, I checked your great posts(lots of them :joy:) about Mac, R, and KNIME. I believe I didn’t miss something. Do you have any suggestion? Thanks!

1 Like

@HaveF with your environment I do see the same error message and I don’t know how that can happen. Reserve and Cairo are present in their latest versions from conda-forge.

If I use a new standalone R installation on Mac and just tell KNIME to use that everything does work fine.

What I can think of is that in the past I have seen some compatibility problems with conda-forge based environments and KNIME. Which is why I have based my Python environment on the anaconda channel - which does not have the r-packages though.

My best idea at the moment would be to not use the environment propagation but do a separate installation of R:

https://docs.knime.com/latest/r_installation_guide/index.html

I will see if I can come up with another idea.

3 Likes

Thanks for your advice :smiley:
(Not so hurry to use R) So I do like to stick the environment propagation way to use R. It feels consistent.

@wiswedel Sorry to disturb.
I see you in the github R code base, especially see your name in RSnippetNodeModel.java, RViewNodeModel.java etc. I believe you are the one who can evaluate the real problem.

If you are not available, could note a ticket about this problem?

Thanks!

1 Like

I think this is for the sc. “Windows Binaries” R version - for people who do not want to deal with all the installation problems but might have a somewhat limited version of R. In KNIME you have three ways of interacting with KNIME:

So I think this has nothing to do. Indeed it would be nice to have a simple way to distribute R for KNIME - but I have not found a way yet besides the official R guide and my (older) collection of R hints.

1 Like

Em… I don’t think so, here is my reason:

  1. the readme of the repo says:
    This repository contains the plugins for the

    • KNIME Interactive R Statistics Integration
    • Windows R binaries for the interactive R integration
    • KNIME Microsoft SQL R integration

    The repo contains three integration.

  2. The knime.log which I post at first complains the java stack trace, which correspond to the files(and lines) in the repo.

The log only print the words in the code, no extra info provided.
Waiting for the developer to rescue…

1 Like