Rstan fails when calling stan from C++ via Rserve


I am trying to use rstan via Rserve, a remote protocol that allow C++ code to call R code and get result back. The C++ Interface to Rserve is the public Rconnection by Simon Urbanek. I have been using this method over many R functions without any problems. However when I try this on rstan it fails miserably. That is when I call rc.eval(“fit <- stan(model_code = scode, iter = 10)”); it fails immediately. Here the rc is the Rconnection, scode is the string :
scode <- "
parameters {
real y[2];
model {
y[1] ~ normal(0, 1);
y[2] ~ double_exponential(0, 2);
assigned successfully before the stan call. rstan was also loaded by “library(rstan)” at the very beginning. It seems that stan is not even bother to compile the stan code, the fail is immediate. On the same machine via a Linux terminal, I have no problem to run the same or more complicated stan code in an R session. So why rstan is not working inside an Rserve session?


Sorry, my bad. the Rserve I connected to is not having rstan properly installed.