Rstanarm: CRAN vs Development version installation issues

Looks like it compiled successfully

That means the compiler and Stan installation are all working well, so the issue is elsewhere.

Looking at the original error, it looks like it only ran out of memory by ~15mb. This can happen if you’re compiling multiple models simultaneously, with each model taking ~2-3gb.

Can you trying installing with fewer cores:

Sys.setenv(MAKEFLAGS="-j2")
devtools::install_github("stan-dev/rstanarm",ref = "feature/survival", build_vignettes = FALSE)

Same issue infortunately

cc1plus.exe: out of memory allocating 15636264 bytes
make: *** [C:/PROGRA~1/R/R-40~1.1/etc/i386/Makeconf:227: stan_files/jm.o] Error 1
rm stan_files/jm.cc stan_files/binomial.cc stan_files/lm.cc stan_files/continuous.cc stan_files/bernoulli.cc stan_files/polr.cc stan_files/surv.cc stan_files/count.cc stan_files/mvmer.cc
ERROR: compilation failed for package ‘rstanarm’
removing ‘C:/Users/shauh/Documents/R/win-library/4.0/rstanarm’
Error: Failed to install ‘rstanarm’ from GitHub:
(converted from warning) installation of package ‘C:/Users/shauh/AppData/Local/Temp/RtmpWQjLOl/file2c7862e42f7e/rstanarm_2.19.1.tar.gz’ had non-zero exit status
In addition: Warning message:
In utils::untar(tarfile, …) :
‘tar.exe -xf “C:\Users\shauh\AppData\Local\Temp\RtmpWQjLOl\file2c7818aa2ef6.tar.gz” -C “C:/Users/shauh/AppData/Local/Temp/RtmpWQjLOl/remotes2c78789e2e32”’ returned error code 1

Hm, I’m afraid I’m not sure what the issue is then. If your compiler and RStan installation are working without issue, it might have something to do with the rstanarm installation itself.

@bgoodri or @jonah might be able to help you here

Compiling rstanarm from source takes a lot of RAM, although it will use less once I get rstan 2.21 onto CRAN to go with the StanHeaders 2.21.

My machine has 32gb of RAM, you think it needs more than that?

@andrjohns thanks for helping troubleshoot

@bgoodri I know the error message says it’s out of memory but if @sea83 really has 32gb of RAM then how is that possible? That’s double what I have and I don’t have RAM issues compiling rstanarm from source. Does it use a lot more memory on windows than mac for some reason?

Hi everybody,

I have the same problem. I want to install ‘rstanarm’ on windows with these commands:

  1. devtools::install_github(“stan-dev/rstanarm”,ref = “feature/survival”, build_vignettes = FALSE)

It installed after uninstalling and re-installing many other packages like ‘glue’, ‘ps’, etc. But did not have ‘stan_surv’ function in the end.
There was a warning too:

Warning message:
In utils::untar(tarfile, ...) :
  ‘tar.exe -xf "C:\Users\z3529455\AppData\Local\Temp\RtmpstuJZu\file755416331bd.tar.gz" -C "C:/Users/z3529455/AppData/Local/Temp/RtmpstuJZu/remotes75543a041272"’ returned error code 1
  1. devtools::install_github(“stan-dev/rstanarm”, build_vignettes = FALSE)

did not install with this error: installation of package ‘rstanarm’ had non-zero exit status.
Here is the error:

Error: Failed to install 'rstanarm' from GitHub:
  (converted from warning) installation of package ‘C:/Users/z3529455/AppData/Local/Temp/RtmpstuJZu/file75541be324a9/rstanarm_2.19.1.tar.gz’ had non-zero exit status
In addition: Warning message:
In utils::untar(tarfile, ...) :
  ‘tar.exe -xf "C:\Users\z3529455\AppData\Local\Temp\RtmpstuJZu\file7554777d77a3.tar.gz" -C "C:/Users/z3529455/AppData/Local/Temp/RtmpstuJZu/remotes7554f9c35f"’ returned error code 1

Then, I decided to update my R and Rtools version to see it makes anything better; however, again I got errors which were related to memory. that is:

cc1plus.exe: out of memory allocating 5401568 bytes
make: *** [C:/Users/z3529455/DOCUME~1/R/R-40~1.1/etc/i386/Makeconf:227: stan_files/jm.o] Error 1
rm stan_files/jm.cc stan_files/binomial.cc stan_files/lm.cc stan_files/continuous.cc stan_files/bernoulli.cc stan_files/polr.cc stan_files/surv.cc stan_files/count.cc stan_files/mvmer.cc
ERROR: compilation failed for package 'rstanarm'
* removing 'C:/Users/z3529455/Documents/R/R-4.0.1/library/rstanarm'
Error: Failed to install 'rstanarm' from GitHub:
  (converted from warning) installation of package ‘C:/Users/z3529455/AppData/Local/Temp/Rtmpg3xybY/file6cc4199c7231/rstanarm_2.19.1.tar.gz’ had non-zero exit status
In addition: Warning message:
In utils::untar(tarfile, ...) :
  ‘tar.exe -xf "C:\Users\z3529455\AppData\Local\Temp\Rtmpg3xybY\file6cc445597d5d.tar.gz" -C "C:/Users/z3529455/AppData/Local/Temp/Rtmpg3xybY/remotes6cc4cbd2c7c"’ returned error code 1

I even tried the advice of @andrjohns which is:

Sys.setenv(MAKEFLAGS="-j2")
devtools::install_github("stan-dev/rstanarm",ref = "feature/survival", build_vignettes = FALSE)

Unfortunately, I get memory errors again.

I would highly appreciate it if someone can help me resolve this issue.

Hello all,

Just contributing that I have experienced a similar error, while compiling the Rstan Stan_Surv feature.

It sounds like it cannot be solved at the moment - and if 32 gb RAM machine cannot compile, than I assume it must be a Windows CCplus1 issue. I had tried playing with the TAR permissions, since Windows has issues with permissions. This did not seem to help. I downgraded StanHeaders, which did not help. I did a full clean install of RStudio and R, as well as cleared my Rprofile. I had errors, too, on my Fedora machine, but I did not rigorously document them. Happy to share all the steps I tried, but not much help since I could not get it to compile.

See my post and the relevant responses here:

1 Like

Are you by any chance able to install it if you specify build_opts = c("--no-multiarch") when calling devtools::install_github()?

Good day,
I am coming to this thread a bit late. But, I have followed it through. I’d like to add my experience. I am on a 64GB RAM PC with windows 10 and I am likewise experiencing the memory error when I attempt to load the development version of rstanarm. I have tried every suggestion in this thread. Nothing seems to help.

Nonetheless, thanks for taking the time to troubleshoot this.

You can install binary or source from CRAN now, although GitHub shouldn’t be building the model that exhausts the address space in 32bit mode.

Do I need to do a “ref=feature/survival” or anything of that sort?

For that branch, yes.

Hello,
I read all the posts here regarding rstanarm from development but I still have a problem. I wan to use stan_surv () function and installed rstanarm from CRAN but the function I snot available from CRAN, I tried to follow all advice to install from Github but got the error as below:




Error: Failed to install 'rstanarm' from GitHub:
  (converted from warning) installation of package ‘C:/~/AppData/Local/Temp/1/Rtmpuy64W3/fileb0acb7a21d8/rstanarm_2.21.2.tar.gz’ had non-zero exit status

Would you kindly advise the right way without getting an error to have stan_surv() working?
Thanks

Until this reaches CRAN, you can install the survival branch of rstanarm from the Stan R packages repository with

install.packages("rstanarm", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))

5 Likes

Thanks a lot for the prompt answer. It worked without any problem.

1 Like

@rok_cesnovar
While this worked on PC, it does not work on cluster or cloud, is there a different approach to download this on Linux, and cluster server?
Thanks

On linux it should install from source, it will take much longer to build but should still work. What exactly do you get when you run this?

I installed using the same syntax but when I run my analysis I get the error as :

could not find function “stan_surv”