Crashing RStudio when compiling brms model

I am trying to run a fairly simple logistic regression (220 datapoints, 5 variables), aiming at first to sample priors only. Here is the model

prior.m1 = c(set_prior("normal(0,5)",class = "b"), 
set_prior("normal(-0.455,0.448)", class = "Intercept"))
m1.brms=brm(formula=pres.abs~ altitude+distance+NoOfPools+NoOfSites+avrain, data=DF1s, 
            family=bernoulli, prior = prior.m1, warmup = 1000,sample_prior = "only",
            chains=4, iter=2000, control = list(adapt_delta = 0.9))  

When starting to compile the Stan code, RStudio (version 1.2.1335) crashes leaving me no other option than to restart another session with identical results. I reinstalled one by one brms, Rcpp, RcppEigen, RcppArmadillo to the latest versions and I obtained the same crashing results. I copy the sessionInfo() below.
I am not suggesting that the problem lies with brms.
I’d be thankful for any suggestions you might have.


R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/
LAPACK: /usr/lib/x86_64-linux-gnu/


attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] pROC_1.17.0.1 qqplotr_0.0.5 DHARMa_0.4.1 reshape2_1.4.4 ggeffects_1.0.2 formulaic_0.0.8
[7] stringi_1.5.3 pbkrtest_0.5.1 lme4_1.1-26 Matrix_1.3-2 GGally_2.1.1 broom_0.7.6
[13] stringr_1.4.0 insight_0.13.2 future_1.21.0 cowplot_1.1.1 boot_1.3-27 brms_2.15.0
[19] Rcpp_1.0.6 ggplot2_3.3.3

loaded via a namespace (and not attached):
[1] TH.data_1.0-10 minqa_1.2.4 colorspace_2.0-0 ellipsis_0.3.1
[5] ggridges_0.5.3 rsconnect_0.8.16 sjlabelled_1.1.7 estimability_1.3
[9] markdown_1.1 base64enc_0.1-3 rstudioapi_0.13 listenv_0.8.0
[13] rstan_2.21.2 DT_0.17 fansi_0.4.2 mvtnorm_1.1-1
[17] bridgesampling_1.1-2 codetools_0.2-18 splines_3.6.3 robustbase_0.93-7
[21] shinythemes_1.2.0 bayesplot_1.8.0 projpred_2.0.2 jsonlite_1.7.2
[25] nloptr_1.2.2.2 shiny_1.6.0 compiler_3.6.3 emmeans_1.6.0
[29] backports_1.2.1 assertthat_0.2.1 fastmap_1.1.0 cli_2.5.0
[33] later_1.1.0.1 htmltools_0.5.1.1 prettyunits_1.1.1 tools_3.6.3
[37] igraph_1.2.6 coda_0.19-4 gtable_0.3.0 glue_1.4.2
[41] dplyr_1.0.5 V8_3.4.0 vctrs_0.3.7 nlme_3.1-152
[45] iterators_1.0.13 crosstalk_1.1.1 globals_0.14.0 ps_1.6.0
[49] mime_0.10 miniUI_0.1.1.1 lifecycle_1.0.0 gtools_3.8.2
[53] statmod_1.4.35 DEoptimR_1.0-8 MASS_7.3-53.1 zoo_1.8-9
[57] scales_1.1.1 colourpicker_1.1.0 promises_1.2.0.1 Brobdingnag_1.2-6
[61] sandwich_3.0-0 parallel_3.6.3 inline_0.3.17 RColorBrewer_1.1-2
[65] shinystan_2.5.0 gamm4_0.2-6 curl_4.3 gridExtra_2.3
[69] loo_2.4.1 StanHeaders_2.21.0-7 reshape_0.8.8 dygraphs_1.1.1.6
[73] foreach_1.5.1 pkgbuild_1.2.0 rlang_0.4.10 pkgconfig_2.0.3
[77] matrixStats_0.58.0 lattice_0.20-41 purrr_0.3.4 rstantools_2.1.1
[81] htmlwidgets_1.5.3 tidyselect_1.1.0 processx_3.5.1 parallelly_1.24.0
[85] plyr_1.8.6 magrittr_2.0.1 R6_2.5.0 generics_0.1.0
[89] multcomp_1.4-16 DBI_1.1.1 pillar_1.6.0 withr_2.4.2
[93] mgcv_1.8-34 xts_0.12.1 survival_3.2-10 abind_1.4-5
[97] tibble_3.1.1 crayon_1.4.1 utf8_1.2.1 grid_3.6.3
[101] data.table_1.14.0 callr_3.6.0 threejs_0.3.3 digest_0.6.27
[105] xtable_1.8-4 tidyr_1.1.3 httpuv_1.5.5 RcppParallel_5.1.2
[109] stats4_3.6.3 munsell_0.5.0 shinyjs_2.0.0

Hi Pablo,

Crashing R is usually related to rstan in this context. Does your session also crash if you run the RStan example model:


Thanks for the response.
R does not now crash when I run:

A few hours after my somewhat desperate message, I chose to do the “brute force” approach of uninstalling reinstalling R 3.6.0 from scratch and updating every R library. My crashing of rstan seems to have been caused by missing specialized numerical libraries that are required in Linux Ubuntu to install rstan, brms and other R libraries. Sometimes these libraries popup when installing or updating R libraries and they can be installed from the Linux terminal. I presume that something went wrong during my updatings of these numerical libraries in Linux that caused rstan to make R crash.
Everything works fine now.
Many thanks again,

1 Like

Great to hear that it’s all working!