Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R crashes during sampling #1070

Open
wpfl-dbt opened this issue May 24, 2023 · 7 comments
Open

R crashes during sampling #1070

wpfl-dbt opened this issue May 24, 2023 · 7 comments

Comments

@wpfl-dbt
Copy link

wpfl-dbt commented May 24, 2023

I'm trying to install rstan to go through Statistical Rethinking, and when I try to verify the installation with example(stan_model, package = "rstan", run.dontrun = TRUE), I get "R encountered a fatal error. The session was terminated". This occurs during the line stan_md> fit <- sampling(mod, data = list(y_mean = 0)) in the console.

This happens whether I install from CRAN or from mc-stan.org. With the second, even though the site suggests I should get 2.26, the version of rstan that comes back from install.packages is 2.21.8, the same as CRAN, so I don't know if that has something to do with it.

I don't know if this is extraneous information, but I have a working installation of CmdStan and CmdStanR, also required for the book. My hunch is there could be some conflict there.

Here's my versions:

Intel macOS Ventura 13.3.1
RStudio 2023.03.1+446
R version 4.3.0
rstan 2.21.8
StanHeaders 2.26.25

@henryrscharf
Copy link

I am experiencing a similar issue, but across mac, linux (ubuntu), and windows implementations. For me, the issue appears to be that a massive amount of memory is used during once sampling is initiated, which ultimately crashes R.

@henryrscharf
Copy link

I tracked my issue back to a recent update for StanHeaders. Re-installing the archived version StanHeaders_2.21.0-7.tar.gz seems to have fixed my memory issue.

@jsocolar
Copy link

jsocolar commented Jun 5, 2023

@andrjohns
Copy link
Contributor

Until we have rstan 2.26 on CRAN if you update to StanHeaders 2.26 then you need to also reinstall rstan 2.21 from source

@kjayhan
Copy link

kjayhan commented Jun 9, 2023

Until we have rstan 2.26 on CRAN if you update to StanHeaders 2.26 then you need to also reinstall rstan 2.21 from source

I use rstan_2.21.8 and StanHeaders_2.26.26, but still when I run "example(stan_model, package = "rstan", run.dontrun = TRUE)"

I get "R session aborted".

R version 4.3.0 (2023-04-21)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.4

@kjayhan
Copy link

kjayhan commented Jun 9, 2023

Until we have rstan 2.26 on CRAN if you update to StanHeaders 2.26 then you need to also reinstall rstan 2.21 from source

I use rstan_2.21.8 and StanHeaders_2.26.26, but still when I run "example(stan_model, package = "rstan", run.dontrun = TRUE)"

I get "R session aborted".

R version 4.3.0 (2023-04-21) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Ventura 13.4

Finally this worked for me: https://discourse.mc-stan.org/t/installing-rstan/20743/2

@mschubert
Copy link

mschubert commented Aug 18, 2023

I'm observing a similar issue specific to rstan=2.21.8 (which is the current version on CRAN): massively increasing memory usage during warmup/sampling, in the 100s of GB. 2.21.7 stays under 2 GB for my model.

Both are using StanHeaders=2.26.27 (also current CRAN). This is on vanilla R=4.3.1 on Gentoo.

Alternatively, using StanHeaders=2.21.0-7, sampling works fine when using rstan=2.21.8

Until we have rstan 2.26 on CRAN if you update to StanHeaders 2.26 then you need to also reinstall rstan 2.21 from source

Ultimately, re-installing both StanHeaders=2.26.27 and rstan=2.21.8 (in this order) from source solved the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants