Compiling RStanArm on Windows


#1

I’m trying to pre-compile the Stan code in rstanarm on my windows device but the developer notes seem to work best for macs.

Can I have some advice on how to do this?

Thanks


#2

I get the following error after running this line:

C:\Program Files\R\R-3.3.1\bin\x64>R CMD INSTALL --preclean “C:\Users\Julian Bautista\Documents\GitHub\rstanarm”

*** arch - i386
make: rm: Command not found
make: *** [shlib-clean] Error 127
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-33~1.1/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-33~1.1/share/make/winshlib.mk" -f "C:\Users\Julian Bautista\Documents/.R/Makevars" CXX='$(CXX1X) $(CXX1XSTD)' CXXFLAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1XLDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="rstanarm.dll"  shlib-clean' had status 2
"C:/PROGRA~1/R/R-33~1.1/bin/i386/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/bernoulli.stan
make: sh.exe: Command not found
make: *** [stan_files/bernoulli.cc] Error 127
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-33~1.1/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-33~1.1/share/make/winshlib.mk" -f "C:\Users\Julian Bautista\Documents/.R/Makevars" CXX='$(CXX1X) $(CXX1XSTD)' CXXFLAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1XLDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="rstanarm.dll" ' had status 2
ERROR: compilation failed for package 'rstanarm'
* removing 'C:/Users/Julian Bautista/Documents/R/win-library/3.3/rstanarm'
* restoring previous 'C:/Users/Julian Bautista/Documents/R/win-library/3.3/rstanarm'

#3

Error 127 means it can’t find your C++ compiler. Once you get that fixed, it will take a really long time to compile rstanarm from source. Most people on Windows just use the CRAN binaries.


#4

Thanks for the quick response! I managed to fix this by changing the PATH.

However, I’m running into a new issue where the package is not attaching.

Error in .doLoadActions(where, attach) :
  error in load action .__A__.1 for package rstanarm: is(module, "character"): object 'm' not found
Error: loading failed
Execution halted
*** arch - x64
Warning: package 'Rcpp' was built under R version 3.3.3
Error in .doLoadActions(where, attach) :
  error in load action .__A__.1 for package rstanarm: is(module, "character"): object 'm' not found
Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'
* removing 'C:/Users/Julian Bautista/Documents/R/win-library/3.3/rstanarm'
* restoring previous 'C:/Users/Julian Bautista/Documents/R/win-library/3.3/rstanarm'

#5

How are you calling it?


#6

Same way as before:

R CMD INSTALL --preclean “C:\Users\Julian Bautista\Documents\GitHub\rstanarm”


#7

Try

R CMD build C:\Users\Julian Bautista\Documents\GitHub\rstanarm
R CMD INSTALL rstanarm*.tar.gz

#8

Neither is working unfortunately. Still getting the same old error that says

Error in .doLoadActions(where, attach) :
error in load action .__A__.1 for package rstanarm: is(module, "character"): object 'm' not found