using rstan library via R scipting nodes?

I’m having trouble using R scripting nodes to run the R library rstan. This library runs a c++ compiler to compile “stan” files (mc-stan.org), executes the compiled files, and allows manipulation of the results. I’m running KNIME 3.5.2, R 3.4.3 and rstan 2.17.3 on Windows.

When I use Rstudio to run my local R install and compile a stan file, compile works but I do get a warning message that seemingly cannot be turned off:
In file included from C:/Users/olson.kd/Documents/R/win-library/3.4/BH/include/boost/config.hpp:39:0,
from C:/Users/olson.kd/Documents/R/win-library/3.4/BH/include/boost/math/tools/config.hpp:13,
from C:/Users/olson.kd/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/core/var.hpp:7,
from C:/Users/olson.kd/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/core/gevv_vvv_vari.hpp:5,
from C:/Users/olson.kd/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/core.hpp:12,
from C:/Users/olson.kd/Documents/R/win-library/3.4/StanHeaders/include/stan/math/rev/mat.hpp:4,
from C:/Users/olson.kd/Documents/R/win-library/3.4/StanHeaders/include/stan/math.hpp:4,
from C:/Users/olson.kd/Documents/R/win-library/3.4/StanHeaders/include/src/stan/model/model_header.hpp:4,
from file3028a251d29.cpp:8:
C:/Users/olson.kd/Documents/R/win-library/3.4/BH/include/boost/config/compiler/gcc.hpp:186:0: warning: “BOOST_NO_CXX11_RVALUE_REFERENCES” redefined

define BOOST_NO_CXX11_RVALUE_REFERENCES

^
:0:0: note: this is the location of the previous definition

When I run the same commands within KNIME, the result is:
Error: ‘C:/Program’ not found

In both cases, the file parser runs at the beginning of the compile command and returns the same warnings.

Any ideas?

Hi Kari,

Can you please confirm whether you are using the same R installation from both KNIME and Rstudio?

Cheers,
Roland

Yes, they are.

RStudio is running [Default] [64-bit] C:\Program Files\R\R-3.4.3
Knimes Path to R home is C:\Program Files\R\R-3.4.3

Hi @KariOlson,

Regarding the warnings in general, I found this: https://github.com/stan-dev/rstan/issues/372. It seems that this is a known issue that shouldn’t affect execution.

Can you please check in your knime.log if there is some more information? Do you get any results back or just the error?

Cheers,
Roland

I’ve seen the github post and had the same issue as the last poster - the “fix” to shut up the warning causes a compiler error (which is worse than the warning).

In Rstudio, I do get results (a compiled model that I can sample), but within Knime the block fails with the previously noted error.

Here’s what I see in the Knime log:

2018-05-25 09:27:36,706 : DEBUG : main : Node : Add Table To R : 0:296 : reset
2018-05-25 09:27:36,706 : DEBUG : main : Node : Add Table To R : 0:296 : clean output ports.
2018-05-25 09:27:36,706 : DEBUG : main : NodeContainer : R Source (Workspace) : 0:295 : Add Table To R 0:296 has new state: IDLE
2018-05-25 09:27:36,707 : DEBUG : main : Node : R Source (Workspace) : 0:295 : reset
2018-05-25 09:27:36,707 : DEBUG : main : Node : R Source (Workspace) : 0:295 : clean output ports.
2018-05-25 09:27:36,707 : DEBUG : main : WorkflowFileStoreHandlerRepository : R Source (Workspace) : 0:295 : Removing handler 49378b2c-8ddf-4774-acbd-4e97f57533c2 (R Source (Workspace) 0:295: ) - 3 remaining
2018-05-25 09:27:36,707 : DEBUG : main : NodeContainer : R Source (Workspace) : 0:295 : R Source (Workspace) 0:295 has new state: IDLE
2018-05-25 09:27:36,707 : DEBUG : main : Node : R Source (Workspace) : 0:295 : Configure succeeded. (R Source (Workspace))
2018-05-25 09:27:36,707 : DEBUG : main : NodeContainer : R Source (Workspace) : 0:295 : R Source (Workspace) 0:295 has new state: CONFIGURED
2018-05-25 09:27:36,708 : DEBUG : main : Node : Add Table To R : 0:296 : Configure succeeded. (Add Table To R)
2018-05-25 09:27:36,708 : DEBUG : main : NodeContainer : R Source (Workspace) : 0:295 : Add Table To R 0:296 has new state: CONFIGURED
2018-05-25 09:27:36,718 : DEBUG : AWT-EventQueue-0 : RController : R Source (Workspace) : 0:295 : Terminating R process
2018-05-25 09:27:37,303 : DEBUG : AWT-EventQueue-0 : RController : R Source (Workspace) : 0:295 : Connected to Rserve in 1 attempt(s) (0ms).
2018-05-25 09:27:37,303 : DEBUG : AWT-EventQueue-0 : RController : R Source (Workspace) : 0:295 : Recovered with a new R process
2018-05-25 09:27:39,370 : DEBUG : main : ExecuteAction : : : Creating execution job for 1 node(s)…
2018-05-25 09:27:39,371 : DEBUG : main : NodeContainer : : : R Source (Workspace) 0:295 has new state: CONFIGURED_MARKEDFOREXEC
2018-05-25 09:27:39,371 : DEBUG : main : NodeContainer : : : R Source (Workspace) 0:295 has new state: CONFIGURED_QUEUED
2018-05-25 09:27:39,372 : DEBUG : main : NodeContainer : : : LT_test_5 0 has new state: EXECUTING
2018-05-25 09:27:39,372 : DEBUG : KNIME-WFM-Parent-Notifier : NodeContainer : : : ROOT has new state: EXECUTING
2018-05-25 09:27:39,372 : DEBUG : KNIME-Worker-11 : WorkflowManager : R Source (Workspace) : 0:295 : R Source (Workspace) 0:295 doBeforePreExecution
2018-05-25 09:27:39,372 : DEBUG : KNIME-Worker-11 : NodeContainer : R Source (Workspace) : 0:295 : R Source (Workspace) 0:295 has new state: PREEXECUTE
2018-05-25 09:27:39,372 : DEBUG : KNIME-Worker-11 : WorkflowManager : R Source (Workspace) : 0:295 : R Source (Workspace) 0:295 doBeforeExecution
2018-05-25 09:27:39,373 : DEBUG : KNIME-Worker-11 : NodeContainer : R Source (Workspace) : 0:295 : R Source (Workspace) 0:295 has new state: EXECUTING
2018-05-25 09:27:39,374 : DEBUG : KNIME-Worker-11 : WorkflowFileStoreHandlerRepository : R Source (Workspace) : 0:295 : Adding handler ed23bf5b-cabc-4f8d-a8a9-ba75cb506d60 (R Source (Workspace) 0:295: ) - 4 in total
2018-05-25 09:27:39,374 : DEBUG : KNIME-Worker-11 : LocalNodeExecutionJob : R Source (Workspace) : 0:295 : R Source (Workspace) 0:295 Start execute
2018-05-25 09:27:39,621 : DEBUG : R Error Reader : RBinUtil : : : External Rscript process error output:
2018-05-25 09:27:39,621 : DEBUG : R Output Reader : RBinUtil : : : External Rscript process output:
2018-05-25 09:27:44,034 : DEBUG : KNIME-Worker-11 : Node : R Source (Workspace) : 0:295 : reset
> 2018-05-25 09:27:44,034 : ERROR : KNIME-Worker-11 : Node : R Source (Workspace) : 0:295 : Execute failed: Error in R code: “Error: ‘C:/Program’ not found”
> 2018-05-25 09:27:44,034 : DEBUG : KNIME-Worker-11 : Node : R Source (Workspace) : 0:295 : Execute failed: Error in R code: “Error: ‘C:/Program’ not found”
org.knime.r.controller.IRController$RException: Error in R code: “Error: ‘C:/Program’ not found”
at org.knime.r.RSnippetNodeModel.runRScript(RSnippetNodeModel.java:279)
at org.knime.r.RSnippetNodeModel.executeSnippet(RSnippetNodeModel.java:206)
at org.knime.r.RSnippetNodeModel.executeSnippet(RSnippetNodeModel.java:170)
at org.knime.r.RSnippetNodeModel.executeInternal(RSnippetNodeModel.java:149)
at org.knime.r.RSnippetNodeModel.execute(RSnippetNodeModel.java:136)
at org.knime.core.node.NodeModel.executeModel(NodeModel.java:567)
at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1172)
at org.knime.core.node.Node.execute(Node.java:959)
at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:561)
at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:95)
at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:179)
at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:110)
at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:328)
at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:204)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:123)
at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:246)
2018-05-25 09:27:44,035 : DEBUG : KNIME-Worker-11 : WorkflowManager : R Source (Workspace) : 0:295 : R Source (Workspace) 0:295 doBeforePostExecution
2018-05-25 09:27:44,035 : DEBUG : KNIME-Worker-11 : NodeContainer : R Source (Workspace) : 0:295 : R Source (Workspace) 0:295 has new state: POSTEXECUTE
2018-05-25 09:27:44,035 : DEBUG : KNIME-Worker-11 : WorkflowManager : R Source (Workspace) : 0:295 : R Source (Workspace) 0:295 doAfterExecute - failure
2018-05-25 09:27:44,035 : DEBUG : KNIME-Worker-11 : Node : R Source (Workspace) : 0:295 : reset
2018-05-25 09:27:44,035 : DEBUG : KNIME-Worker-11 : Node : R Source (Workspace) : 0:295 : clean output ports.
2018-05-25 09:27:44,035 : DEBUG : KNIME-Worker-11 : WorkflowFileStoreHandlerRepository : R Source (Workspace) : 0:295 : Removing handler ed23bf5b-cabc-4f8d-a8a9-ba75cb506d60 (R Source (Workspace) 0:295: ) - 3 remaining
2018-05-25 09:27:44,035 : DEBUG : KNIME-Worker-11 : NodeContainer : R Source (Workspace) : 0:295 : R Source (Workspace) 0:295 has new state: IDLE
2018-05-25 09:27:44,035 : DEBUG : KNIME-Worker-11 : Node : R Source (Workspace) : 0:295 : Configure succeeded. (R Source (Workspace))
2018-05-25 09:27:44,035 : DEBUG : KNIME-Worker-11 : NodeContainer : R Source (Workspace) : 0:295 : R Source (Workspace) 0:295 has new state: CONFIGURED
2018-05-25 09:27:44,037 : DEBUG : KNIME-Worker-11 : Node : Add Table To R : 0:296 : Configure succeeded. (Add Table To R)
2018-05-25 09:27:44,037 : DEBUG : KNIME-Worker-11 : NodeContainer : R Source (Workspace) : 0:295 : LT_test_5 0 has new state: IDLE
2018-05-25 09:27:44,037 : DEBUG : KNIME-WFM-Parent-Notifier : NodeContainer : : : ROOT has new state: IDLE