Problems running stan_model() on Ubuntu 20.04

Hey guys.
I’m having problems with my rstan installed on my Ubuntu 20.04.
I can run my stan program on Windows but I can’t on Ubuntu. Every time I run the stan_model() function it crashes as shown in the figure.

I believe it’s a problem with the C ++ compiler because the error occurs after I run the stan_model() function, precisely in the C ++ translation that shows the “R Session Aborted” screen, but I’m not sure about that.

I managed to capture a screenshot before the notification appeared to better observe the error message (Figure below).

I just used this example command and it was enough to stop RStuido.

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

I’m not the most experienced guy on Linux Ubuntu but I’ve tried uninstalling R and RStudio, including Rstan and all dependencies and it didn’t work. Does anyone have any idea what might be going on?

Thank you for your attention and dedication to the problem. Sincerely Carlos A. Zarzar

P.S. I’m currently working on windows with rstan because of this problem.

  • My session information

R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

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

 [1] LC_CTYPE=pt_BR.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=pt_BR.UTF-8        LC_COLLATE=pt_BR.UTF-8    
 [7] LC_PAPER=pt_BR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            

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

other attached packages:
[1] rstan_2.21.2         ggplot2_3.3.3        StanHeaders_2.21.0-7

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7         pillar_1.5.1       compiler_4.1.2    
 [4] prettyunits_1.1.1  tools_4.1.2        pkgbuild_1.2.0    
 [7] jsonlite_1.7.2     lifecycle_1.0.0    tibble_3.1.0      
[10] gtable_0.3.0       pkgconfig_2.0.3    rlang_0.4.10      
[13] DBI_1.1.1          cli_2.3.1          parallel_4.1.2    
[16] curl_4.3.2         loo_2.4.1          gridExtra_2.3     
[19] withr_2.4.1        dplyr_1.0.5        generics_0.1.0    
[22] vctrs_0.3.6        stats4_4.1.2       grid_4.1.2        
[25] tidyselect_1.1.0   glue_1.4.2         inline_0.3.17     
[28] R6_2.5.0           processx_3.4.5     fansi_0.4.2       
[31] purrr_0.3.4        callr_3.5.1        magrittr_2.0.1    
[34] codetools_0.2-18   matrixStats_0.58.0 scales_1.1.1      
[37] ps_1.6.0           ellipsis_0.3.1     assertthat_0.2.1  
[40] colorspace_2.0-0   V8_3.6.0           utf8_1.2.1        
[43] RcppParallel_5.0.3 munsell_0.5.0      crayon_1.4.1      

I have had similar problems with rstan and brms, and I still haven’t solved it (Fedora34/35). A workaround, however, was to change the backend to cmdstanr and not rely on rstan anymore. Since then I haven’t had the problem again. Maybe that could be a solution for you as well?

1 Like

I formatted my Ubuntu 20.04 and now it works. It could have been some corrupted file, I don’t know.

1 Like