Not able to install RStan


#1

I wanted to demonstrate rstan (and rstanarm too) using RStudio Cloud for my class, as students would run into different issues installing it on their computer and I want them to have some hands on experience with it first. I followed the instruction in https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Mac-or-Linux, and I think I’ve checked g++, build-essential, and libssl-dev are all present in the system. However, I failed to install rstan, with the message

* installing *source* package ‘rstan’ ...
** package ‘rstan’ successfully unpacked and MD5 sums checked
** libs
g++  -I/opt/R/3.4.2/lib/R/include -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"`"/opt/R/3.4.2/lib/R/bin/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"`" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DFUSION_MAX_VECTOR_SIZE=12 -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/RcppEigen/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/StanHeaders/include" -I/usr/local/include   -fpic  -Wno-unused-variable -Wno-unused-function  -Wno-macro-redefined -flto -Wno-unused-local-typedefs -c chains.cpp -o chains.o
g++  -I/opt/R/3.4.2/lib/R/include -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"`"/opt/R/3.4.2/lib/R/bin/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"`" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DFUSION_MAX_VECTOR_SIZE=12 -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/RcppEigen/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/StanHeaders/include" -I/usr/local/include   -fpic  -Wno-unused-variable -Wno-unused-function  -Wno-macro-redefined -flto -Wno-unused-local-typedefs -c init.cpp -o init.o
g++  -I/opt/R/3.4.2/lib/R/include -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"`"/opt/R/3.4.2/lib/R/bin/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"`" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DFUSION_MAX_VECTOR_SIZE=12 -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/RcppEigen/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/StanHeaders/include" -I/usr/local/include   -fpic  -Wno-unused-variable -Wno-unused-function  -Wno-macro-redefined -flto -Wno-unused-local-typedefs -c lang__ast_def.cpp -o lang__ast_def.o
g++  -I/opt/R/3.4.2/lib/R/include -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"`"/opt/R/3.4.2/lib/R/bin/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"`" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DFUSION_MAX_VECTOR_SIZE=12 -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/RcppEigen/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/StanHeaders/include" -I/usr/local/include   -fpic  -Wno-unused-variable -Wno-unused-function  -Wno-macro-redefined -flto -Wno-unused-local-typedefs -c lang__grammars__bare_type_grammar_inst.cpp -o lang__grammars__bare_type_grammar_inst.o
In file included from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/BH/include/boost/spirit/include/phoenix_limits.hpp:11:0,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/BH/include/boost/spirit/home/support/meta_compiler.hpp:16,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/BH/include/boost/spirit/home/qi/meta_compiler.hpp:14,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/BH/include/boost/spirit/home/qi/action/action.hpp:14,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/BH/include/boost/spirit/home/qi/action.hpp:14,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/BH/include/boost/spirit/home/qi.hpp:14,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/BH/include/boost/spirit/include/qi.hpp:16,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/StanHeaders/include/src/stan/lang/grammars/bare_type_grammar_def.hpp:4,
                 from /home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/StanHeaders/include/src/stan/lang/grammars/bare_type_grammar_inst.cpp:1,
                 from lang__grammars__bare_type_grammar_inst.cpp:18:
/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/BH/include/boost/phoenix/core/limits.hpp:44:0: warning: "BOOST_PHOENIX_NO_VARIADIC_EXPRESSION" redefined
 # define BOOST_PHOENIX_NO_VARIADIC_EXPRESSION
 ^
<command-line>:0:0: note: this is the location of the previous definition
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
/opt/R/3.4.2/lib/R/etc/Makeconf:168: recipe for target 'lang__grammars__bare_type_grammar_inst.o' failed
make: *** [lang__grammars__bare_type_grammar_inst.o] Error 4
ERROR: compilation failed for package ‘rstan’
* removing ‘/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.4/rstan’
Warning in install.packages :
  installation of package ‘rstan’ had non-zero exit status

Any help would be greatly appreciated.


#2

This indicates that the available memory was exceeded, and the compilation terminated:

Short term, early next week we should have a pre-built version of rstan available.
Longer term, we are looking to make more memory available.

I’ll post an update when the former is in place.


#3

That would be great and thank you!


#4

A pre-built version is now available, could you give it another try please?


#5

Thank you josh, and I can install rstan now. However, when I call rstan it needs to compile the stan code, and I think I run into the same issue of not have enough memory during that compilation phase.

In the short term, would it be possible to have a pre-built version of rstanarm that have the common models I use in my class pre-compiled? That way I think I can do class demonstration without the need to compile anything. Thank you again.


#6

I can install rstan, but I run into problems when trying to compile and run a model; this works fine on my standalone R install. Any help would be much appreciated!

https://rstudio.cloud/project/29377


#7

Hi Josh, I was just wondering if there was any update on installing rstanarm --- rstan installs fine, but was hoping to use rstanarm for a class demonstration.

Thanks!


#8

I'm sorry, I totally dropped the ball here.
Let me see about caching a pre-built rstanarm right now.


#9

Could you give it a try and let me know how it goes?
I did verify that it installs and loads, but haven't exercised it at all.


#10

I was able to install rstanarm now. I tried to run an example analysis and it looked fine. Thank you very much!


#11

Worked like a charm Josh, thanks much!


#12

Is anybody running into problems using brms? Now might be a good time to check since that's a natural stepping stone after rstanarm.