Installing rstan on Posit cloud does not work

On a new Posit Cloud project, installing rstan does not work:

Here is the start of the error messages:

install.packages("rstan")
Installing package into ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
also installing the dependencies ‘colorspace’, ‘utf8’, ‘farver’, ‘labeling’, ‘munsell’, ‘RColorBrewer’, ‘viridisLite’, ‘fansi’, ‘magrittr’, ‘pillar’, ‘pkgconfig’, ‘backports’, ‘ps’, ‘cli’, ‘glue’, ‘gtable’, ‘isoband’, ‘lifecycle’, ‘rlang’, ‘scales’, ‘tibble’, ‘vctrs’, ‘withr’, ‘checkmate’, ‘matrixStats’, ‘callr’, ‘crayon’, ‘desc’, ‘prettyunits’, ‘processx’, ‘R6’, ‘rprojroot’, ‘StanHeaders’, ‘ggplot2’, ‘inline’, ‘gridExtra’, ‘Rcpp’, ‘RcppParallel’, ‘loo’, ‘pkgbuild’, ‘RcppEigen’, ‘BH’

trying URL 'http://rspm/default/__linux__/focal/latest/src/contrib/colorspace_2.1-0.tar.gz'
Content type 'application/x-gzip' length 2587962 bytes (2.5 MB)

downloaded 2.5 MB

... (skip lots of stuff)

  • DONE (pkgbuild)
  • installing binary package ‘tibble’ ...
  • DONE (tibble)
  • installing binary package ‘ggplot2’ ...
  • DONE (ggplot2)
  • installing source package ‘rstan’ ...
    ** package ‘rstan’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -I"../inst/include" -I"../inst/include/boost_not_in_BH" -I"." -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -DBOOST_NO_AUTO_PTR -D_REENTRANT -DSTAN_THREADS -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include' -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.2/BH/include' -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.2/StanHeaders/include' -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.2/RcppParallel/include' -I/usr/local/include -fpic -g -O2 -c chains.cpp -o chains.o
    In file included from /cloud/lib/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include/Eigen/Core:397,
    from /cloud/lib/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include/Eigen/Dense:1,
    from /cloud/lib/x86_64-pc-linux-gnu-library/4.2/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
    from /cloud/lib/x86_64-pc-linux-gnu-library/4.2/StanHeaders/include/stan/math/prim/mat/meta/append_return_type.hpp:4,
    from /cloud/lib/x86_64-pc-linux-gnu-library/4.2/StanHeaders/include/stan/math/prim/meta.hpp:9,
    from /cloud/lib/x86_64-pc-linux-gnu-library/4.2/StanHeaders/include/stan/math/prim/arr/err/check_nonzero_size.hpp:4,
    from /cloud/lib/x86_64-pc-linux-gnu-library/4.2/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:4,
    from chains.cpp:19:
    /cloud/lib/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:60:39: warning: ignoring attributes on template argument ‘__m128’ {aka ‘__vector(4) float’} [-Wignored-attributes]
    60 | template<> struct is_arithmetic<__m128> { enum { value = true }; };
    | ^
    /cloud/lib/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:61:40: warning: ignoring attributes on template argument ‘__m128i’ {aka ‘__vector(2) long long int’} [-Wignored-attributes]
    61 | template<> struct is_arithmetic<__m128i> { enum { value = true }; };
    | ^
    /cloud/lib/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:62:40: warning: ignoring attributes on template argument ‘__m128d’ {aka ‘__vector(2) double’} [-Wignored-attributes]
    62 | template<> struct is_arithmetic<__m128d> { enum { value = true }; };
    | ^
    /cloud/lib/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:161:43: warning: ignoring attributes on template argument ‘Eigen::internal::Packet4f’ {aka ‘__vector(4) float’} [-Wignored-attributes]
    161 | template<> struct unpacket_traits { typedef float type; enum {size=4, alignment=Aligned16}; typedef Packet4f half; };
    ...

Suggestions?

I see several warnings but I do not see an error message. What is the last output of the installation process?

Example:

Any suggestions?

I had the same problem when trying to install RStan this week in my free posit cloud account.
I assumed it was related to a lack of resources, e.g., my 1 gb of RAM was maxed out, but don't know if this was the actual cause of the compilation failure.

Brian

There is no binary available for rstan on the Posti Package Manager and compilation requires way more than 1GB RAM, if you have a paid account you can increase the memory limit, I maxed out a project to 16GB of RAM and the compilation finished successfully. I this is not possible for you I think there is no practical way for you to use rstan on Posit Cloud.

1 Like

Is there a way to request that a binary be added? I use rstan/rstanarm in teaching my (free) data science course and I would like to provide students with an Posit Cloud option which they might use.

Posit people look at this posts from time to time, and you could also try to contact technical support from within Posit Cloud itself but I suspect there is a non-trivial technical reason or ven maybe a licensing issue that prevents them to make a binary available.

Even if you manage to get rstan installed in a base project you can share with your students, I doubt they will be able to do much with it considering the 1 GB RAM limit for free accounts.

Thanks for the report. This was an issue on the Posit Package Manager side, as our rstan binary builds were failing from running out of memory. The latest version of rstan seems to have a significantly higher memory requirement for compilation than before. We're accounting for that now, and rstan should be installable in both Cloud and from Package Manager, with dependent packages like rstanarm coming soon.

If you come across any other missing binary packages in the future, you can report them on Community using the package-manager tag.

2 Likes