Rstanarm: CRAN vs Development version installation issues

Hi Ben, thanks for your quick response. Unfortunately, this addition made no change. Any other thoughts?

As a side note, when is it expected that the updated package will be available from CRAN?

cheers

Hi Ben, tried another version of the compiler with rstan suggested (RStan Getting Started · stan-dev/rstan Wiki · GitHub).

It appears to download the development version of rstanarm with this installed (refer session_info()), but when I use help(package = “rstanarm”) to get the version it returns the Cran version. I also don’t have access to stan_surv.

I assume it has something to do with this error:

Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted

Which appears frequently throughout the download process.

I have remove chunks from the below pertaining to mver, lm, jm, binomial, count, due to space. I have attached the full output.rstanarm dev installation.txt (34.5 KB)

> remove.packages("rstan")
Removing package from ‘C:/Users/21307937/OneDrive/R Packages’
(as ‘lib’ is unspecified)
Error in remove.packages : there is no package called ‘rstan’
> remove.packages("rstanarm")
Removing package from ‘C:/Users/21307937/OneDrive/R Packages’
(as ‘lib’ is unspecified)
Error in remove.packages : there is no package called ‘rstanarm’
> if (file.exists(".RData")) file.remove(".RData")

> **# compiler from Rstan**
> 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("\nCXX14FLAGS=-O3 -march=corei7 -mtune=corei7",
+     "CXX14 = $(BINPREF)g++ -m$(WIN) -std=c++1y",
+     "CXX11FLAGS=-O3 -march=corei7 -mtune=corei7",
+     file = M, sep = "\n", append = TRUE)

> # Install rstan
> # From suggestion online mc-discourse
> install.packages("rstan", type = "win.binary", dependencies = TRUE)
Installing package into ‘C:/Users/21307937/OneDrive/R Packages’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/rstan_2.19.3.zip'
Content type 'application/zip' length 4734192 bytes (4.5 MB)
downloaded 4.5 MB

package ‘rstan’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\21307937\AppData\Local\Temp\RtmpIntU98\downloaded_packages
> install.packages( "https://win-builder.r-project.org/9256KcZ01L9C/StanHeaders_2.19.2.zip", repos = NULL, type = "win.binary")
Installing package into ‘C:/Users/21307937/OneDrive/R Packages’
(as ‘lib’ is unspecified)
trying URL 'https://win-builder.r-project.org/9256KcZ01L9C/StanHeaders_2.19.2.zip'
Content type 'application/x-zip-compressed' length 2260970 bytes (2.2 MB)
downloaded 2.2 MB

package ‘StanHeaders’ successfully unpacked and MD5 sums checked
> pkgbuild::has_build_tools(debug = TRUE)
[1] TRUE
> if (!require(devtools)) {
+     install.packages("devtools")
+     library(devtools)
+ }
Loading required package: devtools
Loading required package: usethis
> devtools::install_github("stan-dev/rstanarm", build_vignettes = FALSE)

Downloading GitHub repo stan-dev/rstanarm@master
stan-dev-rstanarm-8709540/tests/testthat/include: Can't create '\\\\?\\C:\\Users\\21307937\\AppData\\Local\\Temp\\RtmpIntU98\\remotes17ab47b414359\\stan-dev-rstanarm-8709540\\tests\\testthat\\include'
stan-dev-rstanarm-8709540/tests/testthat/stan_files: Can't create '\\\\?\\C:\\Users\\21307937\\AppData\\Local\\Temp\\RtmpIntU98\\remotes17ab47b414359\\stan-dev-rstanarm-8709540\\tests\\testthat\\stan_files'
tar.exe: Error exit delayed from previous errors.

√  checking for file 'C:\Users\21307937\AppData\Local\Temp\RtmpIntU98\remotes17ab47b414359\stan-dev-rstanarm-8709540/DESCRIPTION' (588ms)
-  preparing 'rstanarm': (776ms)
√  checking DESCRIPTION meta-information ... 
-  cleaning src
-  running 'cleanup.win' (606ms)
-  checking for LF line-endings in source and make files and shell scripts (735ms)
-  checking for empty or unneeded directories
-  looking to see if a 'data/datalist' file should be added
-  building 'rstanarm_2.19.3.tar.gz'
   Warning: file 'rstanarm/cleanup' did not have execute permissions: corrected
   
Installing package into ‘C:/Users/21307937/OneDrive/R Packages’
(as ‘lib’ is unspecified)
* installing *source* package 'rstanarm' ...
** libs

*** arch - i386
"C:/PROGRA~1/R/R-35~1.2/bin/i386/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/continuous.stan
Wrote C++ file "stan_files/continuous.cc"


C:/Rtools/mingw_32/bin/g++ -m32 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c stan_files/continuous.cc -o stan_files/continuous.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted
"C:/PROGRA~1/R/R-35~1.2/bin/i386/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/polr.stan
Wrote C++ file "stan_files/polr.cc"

C:/Rtools/mingw_32/bin/g++ -m32 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c stan_files/polr.cc -o stan_files/polr.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted
"C:/PROGRA~1/R/R-35~1.2/bin/i386/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/bernoulli.stan
Wrote C++ file "stan_files/bernoulli.cc"

C:/Rtools/mingw_32/bin/g++ -m32 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c stan_files/bernoulli.cc -o stan_files/bernoulli.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted
"C:/PROGRA~1/R/R-35~1.2/bin/i386/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/count.stan
Wrote C++ file "stan_files/count.cc"


C:/Rtools/mingw_32/bin/g++ -m32 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c stan_files/count.cc -o stan_files/count.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted
"C:/PROGRA~1/R/R-35~1.2/bin/i386/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/binomial.stan
Wrote C++ file "stan_files/binomial.cc"


C:/Rtools/mingw_32/bin/g++ -m32 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c stan_files/binomial.cc -o stan_files/binomial.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted
"C:/PROGRA~1/R/R-35~1.2/bin/i386/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/mvmer.stan
Wrote C++ file "stan_files/mvmer.cc"


C:/Rtools/mingw_32/bin/g++ -m32 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c stan_files/mvmer.cc -o stan_files/mvmer.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted
"C:/PROGRA~1/R/R-35~1.2/bin/i386/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/lm.stan
Wrote C++ file "stan_files/lm.cc"


C:/Rtools/mingw_32/bin/g++ -m32 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c stan_files/lm.cc -o stan_files/lm.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted
"C:/PROGRA~1/R/R-35~1.2/bin/i386/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/jm.stan
Wrote C++ file "stan_files/jm.cc"


C:/Rtools/mingw_32/bin/g++ -m32 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c stan_files/jm.cc -o stan_files/jm.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted


C:/Rtools/mingw_32/bin/g++ -m32 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c init.cpp -o init.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted
C:/Rtools/mingw_32/bin/g++ -m32 -std=c++1y -shared -s -static-libgcc -o rstanarm.dll tmp.def stan_files/continuous.o stan_files/mvmer.o stan_files/polr.o stan_files/bernoulli.o stan_files/jm.o stan_files/count.o stan_files/binomial.o stan_files/lm.o init.o -LC:/Users/21307937/OneDrive/RPACKA~1/RCPPPA~1/lib/i386 -ltbb -ltbbmalloc -LC:/PROGRA~1/R/R-35~1.2/bin/i386 -lR
rm stan_files/jm.cc stan_files/binomial.cc stan_files/lm.cc stan_files/continuous.cc stan_files/bernoulli.cc stan_files/polr.cc stan_files/count.cc stan_files/mvmer.cc
installing to C:/Users/21307937/OneDrive/R Packages/rstanarm/libs/i386

*** arch - x64
"C:/PROGRA~1/R/R-35~1.2/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/continuous.stan
Wrote C++ file "stan_files/continuous.cc"


C:/Rtools/mingw_64/bin/g++ -m64 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c stan_files/continuous.cc -o stan_files/continuous.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted
"C:/PROGRA~1/R/R-35~1.2/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/polr.stan
Wrote C++ file "stan_files/polr.cc"


C:/Rtools/mingw_64/bin/g++ -m64 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c stan_files/polr.cc -o stan_files/polr.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted
"C:/PROGRA~1/R/R-35~1.2/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/bernoulli.stan
Wrote C++ file "stan_files/bernoulli.cc"


C:/Rtools/mingw_64/bin/g++ -m64 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c stan_files/jm.cc -o stan_files/jm.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted


C:/Rtools/mingw_64/bin/g++ -m64 -std=c++1y  -I"C:/PROGRA~1/R/R-35~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-35~1.2/bin/Rscript" -e "StanHeaders:::CxxFlags()"`	 -I"C:/Users/21307937/OneDrive/R Packages/StanHeaders/include" -I"C:/Users/21307937/OneDrive/R Packages/rstan/include" -I"C:/Users/21307937/OneDrive/R Packages/BH/include" -I"C:/Users/21307937/OneDrive/R Packages/Rcpp/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppEigen/include" -I"C:/Users/21307937/OneDrive/R Packages/RcppParallel/include"        -O3 -march=corei7 -mtune=corei7 -c init.cpp -o init.o
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'CxxFlags' not found
Calls: ::: -> get
Execution halted
C:/Rtools/mingw_64/bin/g++ -m64 -std=c++1y -shared -s -static-libgcc -o rstanarm.dll tmp.def stan_files/continuous.o stan_files/mvmer.o stan_files/polr.o stan_files/bernoulli.o stan_files/jm.o stan_files/count.o stan_files/binomial.o stan_files/lm.o init.o -LC:/Users/21307937/OneDrive/RPACKA~1/RCPPPA~1/lib/x64 -ltbb -ltbbmalloc -LC:/PROGRA~1/R/R-35~1.2/bin/x64 -lR
rm stan_files/jm.cc stan_files/binomial.cc stan_files/lm.cc stan_files/continuous.cc stan_files/bernoulli.cc stan_files/polr.cc stan_files/count.cc stan_files/mvmer.cc
installing to C:/Users/21307937/OneDrive/R Packages/rstanarm/libs/x64
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** byte-compile and prepare package for lazy loading
Warning: package 'Rcpp' was built under R version 3.5.3
** help
No man pages found in package  'rstanarm' 
*** installing help indices
  converting help for package 'rstanarm'
    finding HTML links ... done
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
Warning: package 'Rcpp' was built under R version 3.5.3
*** arch - x64
Warning: package 'Rcpp' was built under R version 3.5.3
* DONE (rstanarm)
In R CMD INSTALL
Warning message:
In utils::untar(tarfile, ...) :
  ‘tar.exe -zxf "C:\Users\21307937\AppData\Local\Temp\RtmpIntU98\file17ab450f917cd.tar.gz" -C "C:/Users/21307937/AppData/Local/Temp/RtmpIntU98/remotes17ab47b414359"’ returned error code 1

library(rstanarm)
Loading required package: Rcpp
rstanarm (Version 2.19.3, packaged: 2020-04-18 00:23:44 UTC)
- Do not expect the default priors to remain the same in future rstanarm versions.
Thus, R scripts should specify priors explicitly, even if they are just the defaults.
- For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores())
- bayesplot theme set to bayesplot::theme_default()
* Does not affect other ggplot2 plots
* See ?bayesplot_theme_set for details on theme setting
Warning message:
package ‘Rcpp’ was built under R version 3.5.3

> help(package = "rstanarm")
    # returns Documentation for package ‘rstanarm’ version 2.19.3
> ?stan_surv
    No documentation for ‘stan_surv’ in specified packages and libraries:
    you could try ‘??stan_surv’




 session_info()
- Session info ---------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.2 (2018-12-20)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_Australia.1252      
 ctype    English_Australia.1252      
 tz       Australia/Perth             
 date     2020-04-18                  

- Packages -------------------------------------------------------------------------------------------------------------------
 package      * version    date       lib source                            
 assertthat     0.2.1      2019-03-21 [1] CRAN (R 3.5.3)                    
 backports      1.1.4      2019-04-10 [1] CRAN (R 3.5.3)                    
 base64enc      0.1-3      2015-07-28 [1] CRAN (R 3.5.0)                    
 bayesplot      1.7.1      2019-12-01 [1] CRAN (R 3.5.3)                    
 boot           1.3-20     2017-08-06 [2] CRAN (R 3.5.2)                    
 callr          3.4.3      2020-03-28 [1] CRAN (R 3.5.3)                    
 cli            2.0.2      2020-02-28 [1] CRAN (R 3.5.3)                    
 codetools      0.2-15     2016-10-05 [2] CRAN (R 3.5.2)                    
 colorspace     1.4-0      2019-01-13 [1] CRAN (R 3.5.2)                    
 colourpicker   1.0        2017-09-27 [1] CRAN (R 3.5.1)                    
 crayon         1.3.4      2017-09-16 [1] CRAN (R 3.5.1)                    
 crosstalk      1.0.0      2016-12-21 [1] CRAN (R 3.5.1)                    
 curl           3.3        2019-01-10 [1] CRAN (R 3.5.2)                    
 desc           1.2.0      2018-05-01 [1] CRAN (R 3.5.1)                    
 devtools     * 2.3.0      2020-04-10 [1] CRAN (R 3.5.2)                    
 digest         0.6.25     2020-02-23 [1] CRAN (R 3.5.3)                    
 dplyr          0.8.4      2020-01-31 [1] CRAN (R 3.5.3)                    
 DT             0.13       2020-03-23 [1] CRAN (R 3.5.3)                    
 dygraphs       1.1.1.6    2018-07-11 [1] CRAN (R 3.5.3)                    
 ellipsis       0.3.0      2019-09-20 [1] CRAN (R 3.5.3)                    
 fansi          0.4.0      2018-10-05 [1] CRAN (R 3.5.2)                    
 fs             1.3.1      2019-05-06 [1] CRAN (R 3.5.3)                    
 ggplot2        3.2.1      2019-08-10 [1] CRAN (R 3.5.3)                    
 ggridges       0.5.1      2018-09-27 [1] CRAN (R 3.5.3)                    
 glue           1.4.0      2020-04-03 [1] CRAN (R 3.5.3)                    
 gridExtra      2.3        2017-09-09 [1] CRAN (R 3.5.1)                    
 gtable         0.2.0      2016-02-26 [1] CRAN (R 3.5.1)                    
 gtools         3.8.1      2018-06-26 [1] CRAN (R 3.5.0)                    
 htmltools      0.3.6      2017-04-28 [1] CRAN (R 3.5.1)                    
 htmlwidgets    1.3        2018-09-30 [1] CRAN (R 3.5.3)                    
 httpuv         1.4.5.1    2018-12-18 [1] CRAN (R 3.5.2)                    
 igraph         1.2.4      2019-02-13 [1] CRAN (R 3.5.3)                    
 inline         0.3.15     2018-05-18 [1] CRAN (R 3.5.3)                    
 later          0.8.0      2019-02-11 [1] CRAN (R 3.5.2)                    
 lattice        0.20-38    2018-11-04 [2] CRAN (R 3.5.2)                    
 lazyeval       0.2.1      2017-10-29 [1] CRAN (R 3.5.1)                    
 lme4           1.1-21     2019-03-05 [1] CRAN (R 3.5.3)                    
 loo            2.2.0      2019-12-19 [1] CRAN (R 3.5.3)                    
 magrittr       1.5        2014-11-22 [1] CRAN (R 3.5.1)                    
 markdown       0.9        2018-12-07 [1] CRAN (R 3.5.3)                    
 MASS           7.3-51.5   2019-12-20 [1] CRAN (R 3.5.3)                    
 Matrix         1.2-15     2018-11-01 [2] CRAN (R 3.5.2)                    
 matrixStats    0.54.0     2018-07-23 [1] CRAN (R 3.5.2)                    
 memoise        1.1.0      2017-04-21 [1] CRAN (R 3.5.1)                    
 mime           0.6        2018-10-05 [1] CRAN (R 3.5.2)                    
 miniUI         0.1.1.1    2018-05-18 [1] CRAN (R 3.5.1)                    
 minqa          1.2.4      2014-10-09 [1] CRAN (R 3.5.1)                    
 munsell        0.5.0      2018-06-12 [1] CRAN (R 3.5.1)                    
 nlme           3.1-137    2018-04-07 [2] CRAN (R 3.5.2)                    
 nloptr         1.2.1      2018-10-03 [1] CRAN (R 3.5.3)                    
 packrat        0.5.0      2018-11-14 [1] CRAN (R 3.5.2)                    
 pillar         1.4.3      2019-12-20 [1] CRAN (R 3.5.3)                    
 pkgbuild       1.0.6.9000 2020-04-17 [1] Github (r-lib/pkgbuild@a475485)   
 pkgconfig      2.0.2      2018-08-16 [1] CRAN (R 3.5.2)                    
 pkgload        1.0.2      2018-10-29 [1] CRAN (R 3.5.3)                    
 plyr           1.8.4      2016-06-08 [1] CRAN (R 3.5.1)                    
 prettyunits    1.0.2      2015-07-13 [1] CRAN (R 3.5.1)                    
 processx       3.4.1      2019-07-18 [1] CRAN (R 3.5.3)                    
 promises       1.0.1      2018-04-13 [1] CRAN (R 3.5.1)                    
 ps             1.3.0      2018-12-21 [1] CRAN (R 3.5.2)                    
 purrr          0.3.3      2019-10-18 [1] CRAN (R 3.5.3)                    
 R6             2.4.0      2019-02-14 [1] CRAN (R 3.5.2)                    
 Rcpp         * 1.0.1      2019-03-17 [1] CRAN (R 3.5.3)                    
 remotes        2.1.1      2020-02-15 [1] CRAN (R 3.5.3)                    
 reshape2       1.4.3      2017-12-11 [1] CRAN (R 3.5.2)                    
 rlang          0.4.5      2020-03-01 [1] CRAN (R 3.5.3)                    
 rprojroot      1.3-2      2018-01-03 [1] CRAN (R 3.5.1)                    
 rsconnect      0.8.15     2019-07-22 [1] CRAN (R 3.5.3)                    
 rstan          2.19.3     2020-02-11 [1] CRAN (R 3.5.3)                    
 rstanarm     * 2.19.3     2020-04-18 [1] Github (stan-dev/rstanarm@8709540)
 rstantools     2.0.0      2019-09-15 [1] CRAN (R 3.5.3)                    
 rstudioapi     0.11       2020-02-07 [1] CRAN (R 3.5.3)                    
 scales         1.0.0      2018-08-09 [1] CRAN (R 3.5.1)                    
 sessioninfo    1.1.1      2018-11-05 [1] CRAN (R 3.5.3)                    
 shiny          1.2.0      2018-11-02 [1] CRAN (R 3.5.2)                    
 shinyjs        1.0        2018-01-08 [1] CRAN (R 3.5.1)                    
 shinystan      2.5.0      2018-05-01 [1] CRAN (R 3.5.3)                    
 shinythemes    1.1.2      2018-11-06 [1] CRAN (R 3.5.3)                    
 StanHeaders    2.19.2     2019-09-07 [1] CRAN (R 3.6.3)                    
 stringi        1.3.1      2019-02-13 [1] CRAN (R 3.5.2)                    
 stringr        1.4.0      2019-02-10 [1] CRAN (R 3.5.2)                    
 survival       2.43-3     2018-11-26 [2] CRAN (R 3.5.2)                    
 testthat       2.3.2      2020-03-02 [1] CRAN (R 3.5.3)                    
 threejs        0.3.1      2017-08-13 [1] CRAN (R 3.5.3)                    
 tibble         2.1.3      2019-06-06 [1] CRAN (R 3.5.3)                    
 tidyselect     0.2.5      2018-10-11 [1] CRAN (R 3.5.2)                    
 usethis      * 1.6.0      2020-04-09 [1] CRAN (R 3.5.2)                    
 withr          2.1.2      2018-03-15 [1] CRAN (R 3.5.1)                    
 xtable         1.8-3      2018-08-29 [1] CRAN (R 3.5.1)                    
 xts            0.11-2     2018-11-05 [1] CRAN (R 3.5.2)                    
 zoo            1.8-7      2020-01-10 [1] CRAN (R 3.5.3)                    

[1] C:/Users/21307937/OneDrive/R Packages
[2] C:/Program Files/R/R-3.5.2/library

When you do

you need to specify ref = "feature/survival".

Elite. Thank you. Worked well.

Thanks for solving this Ben! I sort of wonder whether it is worth having something in the Wiki (or somewhere similar) about installing the feature/survival development branch, since this might keep happening a bit otherwise.

1 Like

I am continuing this thread as I have problems installing the feature/survival branch from Github on OSX Catalina.

I followed Rstan getting started and Installing Rstan from source on a Mac, installed first the macOS R toolchain, then Rcpp and Rstan (version 2.19.3) with

install.packages("Rcpp", repos = "https://rcppcore.github.io/drat")
install.packages("rstan", type = "source")

After this I have succesfully installed and used rstanarm from CRAN

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

Also these installations succeed

install.packages("rstanarm")
devtools::install_github("stan-dev/rstanarm", build_vignettes = FALSE)

However, when I try to install the feature/survival branch from github, it fails:

devtools::install_github("stan-dev/rstanarm@feature/survival", build_vignettes = FALSE)

(Note that below I show only the end of the R output. The full log is very long, as it has some seemingly unrelated warnings that also show up in the successful installations)

** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘rstanarm’ in dyn.load(file, DLLpath = DLLpath, …):
unable to load shared object ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-rstanarm/00new/rstanarm/libs/rstanarm.so’:
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-rstanarm/00new/rstanarm/libs/rstanarm.so, 6): Symbol not found: __ZN20model_polr_namespace24csr_matrix_times_vector2IdN4stan4math3varEEEN5Eigen6MatrixIN5boost4math5tools12promote_argsIT_T0_ffffE4typeELin1ELi1ELi0ELin1ELi1EEERKiSG_RKNS5_ISA_Lin1ELi1ELi0ELin1ELi1EEERKNSt3__16vectorIiNSK_9allocatorIiEEEESQ_RKNS5_ISB_Lin1ELi1ELi0ELin1ELi1EEEPNSK_13basic_ostreamIcNSK_11char_traitsIcEEEE
Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-rstanarm/00new/rstanarm/libs/rstanarm.so
Expected in: flat namespace
in /Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-rstanarm/00new/rstanarm/libs/rstanarm.so
Error: loading failed
Execution halted
ERROR: loading failed
removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rstanarm’
Error: Failed to install ‘rstanarm’ from GitHub:
(converted from warning) installation of package ‘/var/folders/st/bd1mw1z533d4pwb1xxd2vf540000gn/T//RtmpSpPhb2/file15724720f6586/rstanarm_2.19.1.tar.gz’ had non-zero exit status

The same happens if I download the repo and try to install it manually from Rstudio.

This error message seems very similar to the one reported here, but that did not help me forward.

Curiously, I was able to install and use the survival branch on Debian GNU/Linux 10 (buster).

So I have a problem that seems to be specific to the survival branch and OSX. Could it be that rstanarm master branch has been updated recently to cope with OSX Catalina, but the survival branch has not? Or maybe the survival branch is incompatible with rstan version 2.19.3, and I should install an older rstan version first?

Could either @sambrilleman or @bgoodri help me out here?

1 Like

I managed to solve the issue at least partially. The problem appears to be some lines in my .R/Makevars.

After my initial installation of rstan and rstanarm(2.19.3.), I had updated my .R/Makevars based on this and this (if I remember correctly), and it looked like this:

# clang: start
CFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXXFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CPPFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/l$

SHLIB_CXXLDFLAGS+=-Wl,-rpath,${R_HOME}/lib ${R_HOME}/lib/libc++abi.1.dylib
SHLIB_CXX14LDFLAGS+=-Wl,-rpath,${R_HOME}/lib ${R_HOME}/lib/libc++abi.1.dylib
SHLIB_CXX11LDFLAGS+=-Wl,-rpath,${R_HOME}/lib ${R_HOME}/lib/libc++abi.1.dylib

# clang: end

CXX14FLAGS=-O3 -march=native -mtune=native
CXX14FLAGS += -arch x86_64 -ftemplate-depth-256

After commenting out all lines in .R/Makevars, I managed to successfully install the survival branch with

devtools::install_github("stan-dev/rstanarm@feature/survival", build_vignettes = FALSE)

and it seems to work properly.

However, trying to install the downloaded repo manually from RStudio produces the same error as above.

I am also having trouble installing the development version of rstanarm. I’m working on a windows 10 machine with 32gb of ram, but get the following error after running

devtools::install_github("stan-dev/rstanarm",ref = "feature/survival", build_vignettes = FALSE)

cc1plus.exe: out of memory allocating 15696248 bytes
make: *** [C:/PROGRA~1/R/R-40~1.1/etc/i386/Makeconf:227: stan_files/jm.o] Error 1
rm stan_files/jm.cc stan_files/binomial.cc stan_files/lm.cc stan_files/continuous.cc stan_files/bernoulli.cc stan_files/polr.cc stan_files/surv.cc stan_files/count.cc stan_files/mvmer.cc
ERROR: compilation failed for package ‘rstanarm’

Trying to install from the downloaded zipfile has the identical result.

Are you using R4.0 and rtools4? These kinds of errors can occur when upgrading your R and RTools version to the latest versions.

Can you try the instructions in the post below and see if they fix the problem?

I am using rtools4 and R version 4.0.1.

I followed these instructions and am having the same problem.

Alrighty, just to check the existing configuration, can you post the outputs from the following commands:

Sys.which("make")
Sys.getenv("BINPREF")
Sys.getenv("PATH")
readLines("~/.R/Makevars.win")

Sys.which("make")

                          make 

“C:\rtools40\usr\bin\make.exe”

Sys.getenv("BINPREF")

[1] “”

Sys.getenv("PATH")

[1] “C:\rtools40\usr\bin;C:\Program Files\R\R-4.0.1\bin\x64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Rtools\bin;C:\Program Files\ImageMagick-7.0.9-Q16;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;c:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;c:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Users\shauh\AppData\Local\Microsoft\WindowsApps;”

readLines("~/.R/Makevars.win")

[1] “” “CXX14FLAGS=-O3 -march=corei7 -mtune=corei7”
[3] “CXX14 = (BINPREF)g++ -m(WIN) -std=c++1y” “CXX11FLAGS=-O3 -march=corei7 -mtune=corei7”

Can you remove this line from your Makevars.win file:

“CXX14 = (BINPREF)g++−m (WIN) -std=c++1y”

Then restart R and try again?

Sorry, I’m not sure how to do that. Could you please explain how to implement that?

In your ‘My Documents’ folder, you should have a folder called ‘.R’, in that folder will be your Makevars.win file. If you open that with a text editor (like Notepad), you can remove the line that I mentioned

Thanks for that. I removed that line and tried to install rstanarm again but get the identical problem.

Can you check if the RStan example model compiles and samples:

library(rstan)
example(stan_model,run.dontrun = TRUE,verbose=TRUE)

Looks like it compiled successfully

That means the compiler and Stan installation are all working well, so the issue is elsewhere.

Looking at the original error, it looks like it only ran out of memory by ~15mb. This can happen if you’re compiling multiple models simultaneously, with each model taking ~2-3gb.

Can you trying installing with fewer cores:

Sys.setenv(MAKEFLAGS="-j2")
devtools::install_github("stan-dev/rstanarm",ref = "feature/survival", build_vignettes = FALSE)

Same issue infortunately

cc1plus.exe: out of memory allocating 15636264 bytes
make: *** [C:/PROGRA~1/R/R-40~1.1/etc/i386/Makeconf:227: stan_files/jm.o] Error 1
rm stan_files/jm.cc stan_files/binomial.cc stan_files/lm.cc stan_files/continuous.cc stan_files/bernoulli.cc stan_files/polr.cc stan_files/surv.cc stan_files/count.cc stan_files/mvmer.cc
ERROR: compilation failed for package ‘rstanarm’
removing ‘C:/Users/shauh/Documents/R/win-library/4.0/rstanarm’
Error: Failed to install ‘rstanarm’ from GitHub:
(converted from warning) installation of package ‘C:/Users/shauh/AppData/Local/Temp/RtmpWQjLOl/file2c7862e42f7e/rstanarm_2.19.1.tar.gz’ had non-zero exit status
In addition: Warning message:
In utils::untar(tarfile, …) :
‘tar.exe -xf “C:\Users\shauh\AppData\Local\Temp\RtmpWQjLOl\file2c7818aa2ef6.tar.gz” -C “C:/Users/shauh/AppData/Local/Temp/RtmpWQjLOl/remotes2c78789e2e32”’ returned error code 1