Rstan Installation problem, help please

I have a new PC, and installed R, Rstudio, Rtools40 as instructed. It seems Rstan was installed and the example code ran ok although very slow. BUT when I ran a relatively simple model, it either crashed or reported “Error: cannot allocate vector of size 11766.6 Gb”.
Please help…
Thank you very much,
Jie

Here’s what I got from:

Sys.which(“make”)
make
“C:\rtools40\usr\bin\make.exe”
Sys.which(“g++”)
g++
Sys.getenv(“RTOOLS40_HOME”)
[1] “C:\rtools40”

Sys.getenv(“PATH”)
[1] “C:\rtools40\usr\bin;C:\Program Files\R\R-4.0.3\bin\x64;C:\oracle\product\11.2.0\client_1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath_target_102671;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\1E\Client\Extensibility\NomadBranch;C:\oracle\product\11.2.0\client_1\bin;C:\Users\jgao\AppData\Local\Microsoft\WindowsApps”

Here’s what I did during installation:

  1. install R-4.0.3-win

  2. install RStudio-1.3.1093

  3. Install Rtools40, “rtools40-x86_64”, using default settings

  4. run

> writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

  1. Now restart R, and verify that make can be found, which should show the path to your Rtools installation.

Sys.which(“make”)

install.packages("jsonlite", type = "source")

  1. #Makevars Configuration
dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR)) dir.create(dotR)
M <- file.path(dotR, "Makevars.win")
if (!file.exists(M)) file.create(M)
cat("\n CXX14FLAGS += -mtune=native -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2",
    file = M, sep = "\n", append = FALSE)
  1. devtools::install_version("withr", version="2.2.0")
  2. Sys.setenv(MAKEFLAGS = "-j4") # four cores used
  3. install.packages("devtools")

I first installed using install.packages("rstan", type = "source")
but got errors like “ERROR: compilation failed for package ‘RcppParallel’”,then I added “,dependencies = TRUE”, it seemed to be solved, but there seemed to be problem with OpenSSL library.

Then I ran the following lines, it seemed Rstan was installed ok.

Sys.setenv(DOWNLOAD_STATIC_LIBV8 = 1) # only necessary for Linux without the nodejs library / headers
install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE)

This allocation error comes up from time to time. Is it possible you’re loading rds files with old saved fits in it?

That’s will cause problems. See here. Edit: I think if it’s old rds files that are failing to load you’ll need to rerun these fits with your new rstan install for it to work.

If you just copy-paste the code and data for eight schools from here does it run: stat_comp_benchmarks/benchmarks/eight_schools at 64b6597cd17de77e91dcfb1a9977758407017d20 · stan-dev/stat_comp_benchmarks · GitHub ?