RStudio Cloud free instance doesn't have enough memory to install rstanarm

on a fresh RStudio 4.1.0 instance

> install.packages('rstanarm')
Installing package into ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'http://package-proxy/focal/src/contrib/rstanarm_2.21.1.tar.gz'
Content type 'application/x-gzip' length 3541103 bytes (3.4 MB)
==================================================
downloaded 3.4 MB

* installing *source* package ‘rstanarm’ ...
** package ‘rstanarm’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
"/opt/R/4.1.0/lib/R/bin/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/lm.stan
Wrote C++ file "stan_files/lm.cc"


g++ -std=gnu++14 -I"/opt/R/4.1.0/lib/R/include" -DNDEBUG -I"../inst/include" -I"/cloud/lib/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include' -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.1/rstan/include' -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.1/BH/include' -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include' -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.1/RcppParallel/include' -I/usr/local/include  `"/opt/R/4.1.0/lib/R/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"/opt/R/4.1.0/lib/R/bin/Rscript" -e "StanHeaders:::CxxFlags()"` -fpic  -g -O2  -c stan_files/lm.cc -o stan_files/lm.o
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make: *** [/opt/R/4.1.0/lib/R/etc/Makeconf:175: stan_files/lm.o] Error 1
rm stan_files/lm.cc
ERROR: compilation failed for package ‘rstanarm’
* removing ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.1/rstanarm’
Warning in install.packages :
  installation of package ‘rstanarm’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpZRbEqS/downloaded_packages’

I suspect that gcc dies because it runs out of memory since rstanarm installation takes up quite a bit of memory and the RAM gauge in the top right maxes out right before the crash. is there any workaround for this that doesn't involve upgrading my cloud account?

This happens from time to time when a new package version is out, the reason is that the package requires more than 1GB of memory to compile (the current memory limit for the free tier), the way RStudio Cloud addresses this issue is by caching precompiled binaries of the packages but it could take some time for the cache to update to the current package version.

Alternatively, you could try installing a previous version with this command:

remotes::install_version("package_name", version = "x.x.x", repos = 'https://packagemanager.rstudio.com/all/__linux__/focal/latest')

thanks. excuse my ignorance but how do we get at the cached version of the precompiled binaries? is it as simple as calling library(rstanarm) once the cache is updated?

You just install as usual with install.packages('rstanarm') but once it's available the binary is going to be used instead of the source code.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.