Not able to install RStan

Are there pointers somewhere for the Stan team on how to create a shareable project template?

The Stan team has their own active Discourse instance at http://discourse.mc-stan.org; you could probably ask there and get a reply in short order.

@bgoodri It looks to me as if you can do the following:

  1. Create an RStudio Cloud project that has code in .Rprofile to manipulate Makevars as needed

  2. Add other packages, scripts, etc. as necessary to the project

  3. Set the project as viewable by "Everyone"

  4. Share the link with the project. Viewers will get their own temporary copy of the project which they can play with (and optionally save a permanent copy to their account).

OK, thanks. I will try this.

It is also possible to preserve a swapfile for a project? Many simple Stan programs do compile with clang++-3.8 and ~4GB of RAM, but ones that use more matrix algebra (i.e. Eigen templates) still do not.

rstudio.cloud has a Guide built in.

Where does this swapfile get written?

And just to remind folks, for now there is a 1GB limit to the available RAM.

I made my Stan project (with a .Rprofile that writes a ~/.R/Makevars file) viewable by everyone at

https://rstudio.cloud/project/56157

It still cannot compile some of the more complicated Stan programs, but you can compile a lot of them. About 488 of the 505 programs accessible via rstan::stan_demo() work.

I just loaded the project and I don't actually see the .Rprofile file there. @josh or @Robby is there any filtering of .Rprofile files that we currently do?

@bgoodri what directory did you place the .Rprofile in?

Home

dir("~", all.files = TRUE)
 [1] "."             ".."            ".bash_history" ".bash_logout"  ".bashrc"       ".config"       ".profile"      ".R"            ".Rprofile"    
[10] ".rstudio"      "R"  

OK, apparently you all were telling me repeatedly that I should have a .Rprofile file in Stan project directory that configures the C++ toolchain, rather than (or in additional to) the .Rprofile file in the home directory, but I could not conceive of there being two .Rprofile files. It seems to be working now, so anyone who tried to fork my Stan project from

https://rstudio.cloud/project/56157

please fork again.

Chiming in to say this confusion is not uncommon! I think Efficient R Programming does a nice job laying out the whole picture: 2 Efficient set-up | Efficient R programming

3 Likes

Hi @jjallaire @josh @Robby . As you might have seen, Andrew Gelman blogged being able to use Stan on RStudio Cloud this AM, so hopefully it did not crash. Predictably, I am already hearing some grumbling about not being able to compile the Stan models people really want to run within the 1GB limit using clang++ 3.8. I think I could get a bit farther if my project that people are forking from had access to a version of clang++ that was at least 3.9 and hence supports ThinLTO. The end of this LLVM blog post claims that big memory gains can be achieved with it. It looks as if the Xenial repo has clang-3.9, clang-4.0, and clang-5.0.

It does, which would you prefer?

Let's try with clang-5.0, although that may additionally require lld-5.0 to link properly, which is also in the Xenial-updates repo. Thanks!

Sounds good.

Could you direct message me something that I could use to verify that it accomplishes what you want that I could use to test in our staging environment before deploying to production?

Hi Josh,

Wanted to re-open this thread---I had previously installed rstanarm without any trouble, but now I'm getting a failure. I was able to install RStan though. Here's the error, and not sure if others are having a similar problem...

/usr/include/c++/5/bits/unique_ptr.h:49:28: note: declared here
template class auto_ptr;
^
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.5.0/lib/R/etc/Makeconf:166: recipe for target 'stan_files/lm.o' failed
rm stan_files/lm.cc
make: *** [stan_files/lm.o] Error 4
ERROR: compilation failed for package ‘rstanarm’

  • removing ‘/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.5/rstanarm’

New version of rstanarm was released that will need to be cached. If you explicitly install 2.17.4, you should be okay for now.

Should be good with rstanarm now.

Works great Josh, thanks much!