Problem loading rstan on Linux

I am using r 3.6.0 on the HPC of my university(Linux system) and I installed rstan in a conda environment in September. However, when I tried to library rstan today, I received this message:

Error: package or namespace load failed for ‘rstan’ in .doLoadActions(where, attach):
error in load action .A.1 for package rstan: Rcpp::loadModule(module = “class_model_base”, what = TRUE, env = ns, : Unable to load module “class_model_base”: cannot allocate vector of size 699249.8 Gb

I tried install rcpp before library it, but same thing happens. Is there any advice?

You need to reinstall the Rcpp package from source using the same compiler that you use for Stan.

Thanks for the answer. However, even after I remove Rcpp and reinstall it in R from source using install.packages(“Rcpp”,type=“source”) , the same error message appears after I try to install rstan again…

1 Like

You are going to have to reinstall rstan too once the Rcpp is reinstalled.

Yeah I also did that… I deleted both Rcpp and rstan and then reinstalled them, but same thing happened. I also tried to create a new environment and reinstall everything (r, r-v8, rcpp, rstan) there, but nothing changes.

I would also include RcppParallel on that list.

Yes. Sorry for not specifying clearly in the previous answer, I also removed rcpparallel and rcpp eigen.

Which compiler?

It is gcc/8.2.1

That should be fine, although if any other compilers are available on the system, I might try that.

I tried use gcc/6.2.1 but it doesn’t work for me either. However, I just found that I can install rstan using conda and it did work out for me! I suppose the conda version should be the same as the source version. Is that right?

Yes. Usually conda breaks rstan but rstan works with regular R. Perhaps something with your configuration has caused them to reverse.

I guess it is because of some settings in the hpc of university. Anyway, thanks for your help!