stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.04k stars 265 forks source link

Error: vector memory exhausted (limit reached?) in macOS Mojave (10.14.5) #657

Open laresbernardo opened 5 years ago

laresbernardo commented 5 years ago

If I try to run the following code I get Error: vector memory exhausted (limit reached?).

library(rstan)
model_code <- 'parameters {real y;} model {y ~ normal(0,1);}'
fit <- stan(model_code=model_code) 

I get the same results running within R in Terminal or Rstudio. My machine's got 16GB RAM.

I already opened an issue ticket in prophet's GITHUB because my original issue came from there! But they told me it's a rstan issue (I guess with macOS)...

This is my session info:

R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] rstan_2.18.2       StanHeaders_2.18.1 ggplot2_3.1.1     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1         rstudioapi_0.10    magrittr_1.5       tidyselect_0.2.5  
 [5] munsell_0.5.0      colorspace_1.4-1   R6_2.4.0           rlang_0.3.4       
 [9] plyr_1.8.4         dplyr_0.8.1        tools_3.6.0        parallel_3.6.0    
[13] pkgbuild_1.0.3     grid_3.6.0         gtable_0.3.0       loo_2.1.0         
[17] cli_1.1.0          withr_2.1.2        matrixStats_0.54.0 lazyeval_0.2.2    
[21] assertthat_0.2.1   tibble_2.1.3       crayon_1.3.4       processx_3.3.1    
[25] gridExtra_2.3      callr_3.2.0        purrr_0.3.2        ps_1.3.0          
[29] inline_0.3.15      glue_1.3.1         compiler_3.6.0     pillar_1.4.1      
[33] prettyunits_1.0.2  scales_1.0.0       stats4_3.6.0       pkgconfig_2.0.2  

Hope you guys can help me fix this! thanks 👍

jpzhangvincent commented 5 years ago

I have the same issue after I updated prophet. Any pointer would be appreciated!

bgoodri commented 4 years ago

I'm not sure. I think it is a configuration issue that affects like 1% of people on Mojave. There is a workaround involving g++ discussed at https://discourse.mc-stan.org/t/rstan-error-vector-memory-exhausted-limit-reached/7753