Model not running after upgrading to rstan 2.21.1 and stanheaders 2.21.0-5

I’m on Ubuntu 18.04 and running R 3.6.

This model used to work before I upgraded (by accident) to rstan 2.21.1 and stanheaders 2.21.0-5. Now it just hangs after printing this message and nothing happens

library(rstan)
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())
parallel:::setDefaultClusterOptions(setup_strategy = "sequential")

fit <- stan(file='sor1_beta_slopes.stan', data=data,cores=4)

The NEXT version of Stan will not be able to parse your Stan program.
Please open an issue at
 https://github.com/stan-dev/stanc3/issues 
if you can share or at least describe your Stan program. This will help ensure that Stan
continues to work on your Stan programs in the future. Thank you!
This message can be avoided by wrapping your function call inside suppressMessages().

Semantic error in 'string', line 2, column 12 to column 13:

Integer literal cannot be larger than 2_147_483_647.

Please help.

A patch was added on Github several hours ago. Try re-installing the latest from Github:

remotes::install_github("stan-dev/rstan", ref = "develop", subdir =
"rstan/rstan")

The messages about a “NEXT version” is just informational as Stan is testing a new parser.

No, same problem even after upgrading.

Hi, the bugfix has not been published yet. Still waiting on the build server. Will post when its ready.

Can you try again now?

remotes::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan")
Skipping install of 'rstan' from a github remote, the SHA1 (b683550b) has not changed since last install.  Use `force = TRUE` to force installation

You don’t need to reinstall rstan; you just need to try running your Stan model again.

The “NEXT” message no longer appears but nothing happens after running

fit <- stan(file='sor1_beta_slopes.stan', data=data)

Can you recommend a combination of rstan and stanheaders versions that work?

Thanks

I think STAN runs but no progress is shown in the console. I run this simple model and it produces a STAN object as expected. However R doesn’t show warmup, sampling, which chain is running etc.

data<-list(N=100,heights=rnorm(100,172,20))

STAN model

data{
int N;
vector[N] heights;
}
parameters{
real<lower=0> mu;
real<lower=0> sigma;
}
model{
  mu~normal(170,20);
  sigma~exponential(1);
  heights~normal(mu,sigma);
}

fit1<-stan("heights_model.stan",data=data,verbose=TRUE)

Next I’m going to try my initial model and let run to see what happens.

I confirm that after the fix the model runs as expected.

Did you mean to remove the progress info? Is there any option that I have to select now?

I think you should still see printouts. Can you try restarting your R session or running something like stan_demo("eight_schools") from a command line R session?

This is related to RStudio. Running the example,

stan_demo("eight_schools", cores = 2)

in a terminal shows progress messages but in RStudio does not.

Yes, I’m using RStudio, sorry I didn’t mention it before. Is there an option for allowing me to see printouts?

This is what is shown in the console.

stan_demo(“eight_schools”, cores = 2)

> J <- 8

> y <- c(28,  8, -3,  7, -1,  1, 18, 12)

> sigma <- c(15, 10, 16, 11,  9, 11, 10, 18)

> tau <- 25
recompiling to avoid crashing R session
Inference for Stan model: eight_schools.
4 chains, each with iter=2000; warmup=1000; thin=1; 
post-warmup draws per chain=1000, total post-warmup draws=4000.

           mean se_mean   sd   2.5%    25%    50%    75% 97.5% n_eff Rhat
mu         7.99    0.22 5.44  -2.09   4.23   8.02  11.47 18.54   615 1.01
theta[1]  11.97    0.32 8.72  -2.74   6.28  11.26  16.30 32.29   750 1.00
theta[2]   8.01    0.20 6.47  -4.40   3.65   7.95  12.12 21.00  1049 1.00
theta[3]   5.91    0.24 7.99 -11.58   1.18   6.36  11.04 20.90  1147 1.00
theta[4]   7.62    0.20 6.59  -5.55   3.33   7.91  11.71 20.89  1068 1.00
theta[5]   4.70    0.21 6.55  -9.26   0.60   5.07   9.26 16.45   943 1.01
theta[6]   5.98    0.19 6.85  -8.32   1.57   6.38  10.85 18.29  1313 1.00
theta[7]  11.02    0.25 7.14  -1.58   6.23  10.51  15.10 26.47   849 1.00
theta[8]   8.59    0.21 8.18  -7.13   3.47   8.52  13.20 26.09  1544 1.00
tau        7.33    0.26 5.56   1.34   3.42   5.92   9.71 22.05   469 1.00
lp__     -18.42    0.30 4.94 -27.89 -21.93 -18.69 -14.90 -8.55   273 1.01

Samples were drawn using NUTS(diag_e) at Fri Jul 10 18:42:44 2020.
For each parameter, n_eff is a crude measure of effective sample size,
and Rhat is the potential scale reduction factor on split chains (at 
convergence, Rhat=1).
Warning messages:
1: There were 66 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See
http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup 
2: Examine the pairs() plot to diagnose sampling problems
 
3: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
Running the chains for more iterations may help. See
http://mc-stan.org/misc/warnings.html#bulk-ess 
4: Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
Running the chains for more iterations may help. See
http://mc-stan.org/misc/warnings.html#tail-ess

They were supposed to already be there but perhaps there is something preventing them from being seen on a Mac with RStudio. If you specify open_progress = TRUE it might open the text files in a webbrowser, or at least it is supposed to.

I’m on Ubuntu 18.04. With open_progress = TRUE Rstudio prints progress only after sampling is done.

OK. After further review, it turns out that I intentionally switched from using sockets to using mclapply on Macs due to the RStudio bug

However, I didn’t realize the the progress thing would not work on Macs because it works fine on linux.

2 Likes

Fix confirmed. Thank you.

1 Like