stan-dev / stan-dev/rstan

"The NEXT version of Stan will not be able to pre-process your Stan program."

Open
#818 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary:

I re-installed my rstan package earlier today, and warning msg starts to show up, and also some models that used to work ok now cannot be run.

Description:

After re-installing rstan, I followed the start guide and checked the following:

pkgbuild::has_build_tools(debug = TRUE)

Somehow it showed FALSE. So I further installed the C++ toolchain using the macOS R toolchain installer.

Now whenever I need to do model fit, I see this message

sh: clang++ -mmacosx-version-min=10.13: command not found
The NEXT version of Stan will not be able to pre-process 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().
Error in FUN(X[[i]], ...) :
trying to get slot "mode" from an object of a basic class ("NULL") with no slots

And it's usually accompanied with this error msg:

Warning messages:
1: In system2(CXX, args = ARGS) : error in running command
2: In file.remove(c(unprocessed, processed)) :
cannot remove file '/var/folders/fr/b4bvkc_11vj3ntd1r6859x5m0000gn/T//RtmpjkdCOb/file13be45025d82.stan', reason 'No such file or directory'

Sometimes the model can run. Sometimes it failed (whereas previously works ok). And when it fails, in addition to the previous msg, I also got the following one:

3: In mccollect(jobs) : 2 parallel jobs did not deliver results

Reproducible

Here's the codes I was using where it fails to run:

stan file (filename:lab-02-nopool.stan) :

data { 
  int<lower=0> n;           // items 
  int<lower=0> N[n];        // initial trials 
  int<lower=0> y[n];        // initial successes 
  real<lower = 0> a;        // beta param1
  real<lower = 0> b;        // beta param2
} 
parameters { 
  vector<lower=0, upper=1>[n] theta;  // chance of success (unpooled) 
} 
model { 
  y ~ binomial(N, theta);  // likelihood 
  theta ~ beta(a,b);
}

R code

tumors <- read.csv(file = url("http://www.stat.columbia.edu/~gelman/book/data/rats.asc"),
                     skip = 2, header = T, sep = " ")[,c(1,2)]
y <- tumors$y
N <- tumors$N
n <- length(y)

stan_dat <- list(n = n, N = N, y =y, a = 1, b = 1)
fit_nopool <- stan('lab-02-nopool.stan', data = stan_dat, chains = 2, refresh = 0)
nopool_output <- rstan::extract(fit_nopool)

Here's info on my systems:

RStan Version:

2.21.1

R Version:

R 4.0.1

Operating System:

macOS Catalina 10.15.5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied pkgbuild::has_build_tools(debug = TRUE) check and the stan('lab-02-nopool.stan', ...) call using the included R code on macOS Catalina. Investigate the reported clang++ command-not-found and confirm that the Stan model compiles and runs without the intermittent errors; the issue does not identify a repository file or test to change.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, macos, r
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.