Rstan Compilation Hangs

I would definitely not reformat your hard drive. What is

rstan:::get_CXX()

?

This:

rstan:::get_CXX()
[1] “clang++ -mmacosx-version-min=10.13”

The answer to the command was:
[1] “clang++ -mmacosx-version-min=10.13”
Does it say anything informative?
Thanks,
Gonçalo

Well, that is what it is supposed to say. When you do

example(stan_model, package = "rstan", run.dontrun = TRUE)

what do you see under “make would run …”

I can’t find a “make would run …” in the output from this command.

It says this:

example(stan_model, package = “rstan”, run.dontrun = TRUE)
Loading required package: StanHeaders
Loading required package: ggplot2
rstan (Version 2.21.2, GitRev: 2e1f913d3ca3)
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores()).
To avoid recompilation of unchanged Stan programs, we recommend calling
rstan_options(auto_write = TRUE)

stn_md> stancode ← ‘data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}’

stn_md> mod ← stan_model(model_code = stancode, verbose = TRUE)

TRANSLATING MODEL ‘16a540c6086086816528e4524def24d9’ FROM Stan CODE TO C++ CODE NOW.
successful in parsing the Stan model ‘16a540c6086086816528e4524def24d9’.

And then it leaves me hanging, with an R process going on in Activity Monitor.

Then you first need to upgrade your inline package.

ok, I did

install.packages("inline")

and then, after selecting a CRAN mirror, I got this output:

**--- Please select a CRAN mirror for use in this session ---**
**trying URL 'https://cloud.r-project.org/bin/macosx/contrib/4.0/inline_0.3.16.tgz'**
**Content type 'application/x-gzip' length 123105 bytes (120 KB)**
**==================================================**
**downloaded 120 KB**


**The downloaded binary packages are in**
**	/var/folders/kf/zkk64rtj5197pzwq94qfls0w0000gn/T//RtmpAzkWCP/downloaded_packages**

but then, I tried

example(stan_model, package = "rstan", run.dontrun = TRUE)

and was left hanging again

Before or after all the output that has “make would run …”?

Before. Here is what I see:

example(stan_model, package = “rstan”, run.dontrun = TRUE)

stn_md> stancode ← ‘data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}’

stn_md> mod ← stan_model(model_code = stancode, verbose = TRUE)

TRANSLATING MODEL ‘16a540c6086086816528e4524def24d9’ FROM Stan CODE TO C++ CODE NOW.
successful in parsing the Stan model ‘16a540c6086086816528e4524def24d9’.
indent preformatted text by 4 spaces

Nothing happens after this output. No ‘make would run…’, no command line, no error message. It just hangs there forever. While it does it, Activity Monitor shows an R process in the CPU. In order to close R, I have to force quit R and then this process.

Does this work?

delete rstan 2.21.2 and then install older version …

remotes::install_version(package = "rstan", version = "2.19.3")

1 Like

For the first time in weeks, something different happened. Thank you so much, MilaniC, for providing this sense of relief!

The comand:

example(stan_model, package = “rstan”, run.dontrun = TRUE)

actually resulted in a long output that includes sampling from four chains and saves a stan script, a stanmodel, and two stanfit objects to my workspace. So, R did not leave me hanging. I got back to the command line in the end.

I am hesitant to copy and paste the very long output here, but I wonder how this result can help me figure out what is going on with the most recent version of rstan. Any idea?

It appeared to be hanging, but when I pressed “enter” it worked…

I had followed these instructions for installation on Mac with M1 chip.