Not able to install brms & rstan package on Linux R server

Hi, I am trying to install brms package on my Linux R server. Below is the specification of my platform:

platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          6.3                         
year           2020                        
month          02                          
day            29                          
svn rev        77875                       
language       R                           
version.string R version 3.6.3 (2020-02-29)
nickname       Holding the Windsock

In order to install the brms package I am using below installation command:

install.packages("brms", repos = "https://cran.rstudio.com")

But I am getting below error:

I also tried installing rstan but it is failing as well:

install.packages("rstan", repos = "https://cran.rstudio.com")

But I am facing below error:

Error in .shlib_internal(args) : 
  C++14 standard requested but CXX14 is not defined
* removing ‘/opt/R/3.6.3/rstan’
Warning in install.packages :
  installation of package ‘rstan’ had non-zero exit status

It would be very helpful if someone could support me. My objective is to use “brm” function.

Thanks in advance,
Shubham

1 Like

As you point out, you are missing a Linux system dependency on your machine, specifically C++14.

A good way to get a platform-specific set of instructions to install system dependencies is to use the public instance of RStudio package manager , and to browse to the package page, in this case the rstan page at Posit Package Manager.

On this page you can find instructions to install the system dependencies. This is going to depend on the exact version of the operating system you have installed (you don't mention what you are using).

Let's imagine you are using Ubuntu 20-04, in which case the instructions are:

apt-get install -y pandoc-citeproc
apt-get install -y pandoc
apt-get install -y make
apt-get install -y libcurl4-openssl-dev
apt-get install -y libssl-dev
apt-get install -y libv8-dev

You can also find the instructions on the rstan instructions page at RStan Getting Started · stan-dev/rstan Wiki · GitHub

+1 to what @andrie said.

A few additional notes: Stan-specific installation help can be obtained on dedicated Stan forums (discourse.mc-stan.org/).

Also, it is often easier to install the (still somewhat experimental) cmdstanr package than rstan. (see https://mc-stan.org/cmdstanr/articles/cmdstanr.html). You can then run

options(brms.backend = "cmdstanr")

and brms will run with cmdstanr.

Best of luck with setting up Stan, it is a good tool, but can be sometimes hard to get running.

EDIT: I just noticed the question also got asked at https://discourse.mc-stan.org/t/problem-installing-brms-package-on-linux-server/20817

Thank you so much Martin for the suggestion. I have installed cmdstanr and have run
options(brms.backend = "cmdstanr"). However, I am still not able to use "brm" function.
My final objective is to run bayesian regression model and I am using "brm" function for that. "brm" function comes with "brms" package, which requires rstan as dependecy.
Could you please help how can I use brm function using cmdstanr?

Many thanks for your help.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.