Announcement: Stan R Packages Repo Deprecated - Moving to R-Universe

Hello to the Stan R community!

This post is to announce that we will be deprecating our custom R-packages repo ("https://mc-stan.org/r-packages/") and instead using R-Universe for building and distributing our R packages.

This allows us to take advantage of R-Universe’s fantastic infrastructure for automatically building R package binaries for a range of platforms (including WASM! - but not always, see the ps below). This means that all of our packages now provide binaries for Windows and MacOS (Intel & Apple Silicon).

You can follow the same process for installing packages, all that is changing is the repo URL.

Not all of our packages in the repository are directly building off the develop branch of the respective Github repo, so I’ve summarised the configurations below.

Let me know if you run into any issues!

Package Configurations

rstan & StanHeaders

rstan and StanHeaders are built from the experimental branch, which follows the current release schedule (Stan v2.35):

install.packages("rstan", repos = c("https://stan-dev.r-universe.dev",
                                    "https://cloud.r-project.org"))

rstanarm

rstanarm is built from the feature/survival branch (which provides stan_surv), and is compiled against the experimental branch of rstan above:

install.packages("rstanarm", repos = c("https://stan-dev.r-universe.dev",
                                       "https://cloud.r-project.org"))

cmdstanr

Unlike the other R packages, the cmdstanr package is only updated/built for release versions (currently 0.8.0), it does not automatically update on changes to the Github repository:

install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev",
                                       "https://cloud.r-project.org"))

All Others

All of our other R packages are automatically updated/rebuilt on any changes to their respective development repositories:

rstantools
install.packages("rstantools", repos = c("https://stan-dev.r-universe.dev",
                                         "https://cloud.r-project.org"))
loo
install.packages("loo", repos = c("https://stan-dev.r-universe.dev",
                                  "https://cloud.r-project.org"))
posterior
install.packages("posterior", repos = c("https://stan-dev.r-universe.dev",
                                        "https://cloud.r-project.org"))
projpred
install.packages("projpred", repos = c("https://stan-dev.r-universe.dev",
                                        "https://cloud.r-project.org"))
bayesplot
install.packages("bayesplot", repos = c("https://stan-dev.r-universe.dev",
                                        "https://cloud.r-project.org"))
posteriordb
install.packages("posteriordb", repos = c("https://stan-dev.r-universe.dev",
                                        "https://cloud.r-project.org"))
shinystan
install.packages("shinystan", repos = c("https://stan-dev.r-universe.dev",
                                        "https://cloud.r-project.org"))

rstan packages and WASM

R packages which distribute Stan models cannot currently be built for WASM/webR as the version of the TBB used by RcppParallel does not support building for WASM. However, I’m currently working on updating the WASM build dependencies to support the TBB, so you’ll soon be able to run your favourite Stan package in the browser!

(Note that you won’t be able to use rstan itself to compile models in WASM, as webR does not support compiling code in the browser)

10 Likes

@andrjohns Note that before Fix control variable initialization by SoilRos · Pull Request #1346 · oneapi-src/oneTBB · GitHub, oneTBB contained a static initialization ordering bug which manifested itself in the WASM compilation which caused issues for Stan. This PR is still unreleased (should be in the next version in a month or two, based on their release cycle)

3 Likes

Oh dang, thanks for the heads-up!

I ran your code to install rstanarm + library(rstanarm), but still can’t run stan_surv

Error: ‘stan_surv’ is not an exported object from ‘namespace:rstanarm’

How can I solve it?

What output do you get from:

sessionInfo(package="rstanarm")

sessionInfo(package=“rstanarm”)
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
character(0)

other attached packages:
[1] rstanarm_2.32.1

That output shows that rstanarm is version 2.32.1, while the version in the R packages repo is 2.35