I’m having trouble getting RStan to work - after updating to R 4.0 I ran into a compiler issue very similar to: Compilation Error (Please Help!). After downgrading to R 3.6.3, I am getting a permission error similar to the one documented in: Cannot load dll from temporary directory when using Stan. It was suggested in that thread that antivirus software might be the problem, but temporarily disabling my anti-virus did not fix this issue. RStan was working prior to the installation a few days ago, but I don’t remember what the version was. I currently have R 3.6.3 installed, and the question focuses on the second issue. I am using RStudio 1.3.959 (most recent version).
Running:
example(stan_model, package = "rstan", run.dontrun = TRUE)
gives no error, but I get the following:
Warning message:
In file.remove(c(unprocessed, processed)) :
cannot remove file 'C:\Users\micha\AppData\Local\Temp\RtmpsltHLA\file49901bea335b.stan', reason 'No such file or directory'
However, when I try to sample from my own model (which worked a few days ago), I get the following error:
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Users/micha/AppData/Local/Temp/Rtmp8ofFwd/file19bc19fe73c3.dll':
LoadLibrary failure: The specified procedure could not be found.
I checked that the dll file in question exists, but for some reason Stan can’t seem to open it.
- Operating System: Windows 10
- RStan Version: 2.21.0
- Output of
writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))
(I used a different path to get this:writeLines(readLines("C:\\Users\\micha\\OneDrive\\Documents\\R\\win-library\\3.6\\rstantools\\include\\sys\\Makevars.win"))
):
STANHEADERS_SRC = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "message()" -e "cat(system.file('include', 'src', package = 'StanHeaders', mustWork = TRUE))" -e "message()" | grep "StanHeaders")
PKG_CPPFLAGS = -I"../inst/include" -I"$(STANHEADERS_SRC)" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DRCPP_PARALLEL_USE_TBB=1
PKG_CXXFLAGS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "RcppParallel::CxxFlags()") $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "StanHeaders:::CxxFlags()")
PKG_LIBS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "RcppParallel::RcppParallelLibs()") $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "StanHeaders:::LdFlags()")
CXX_STD = CXX14
- Output of
devtools::session_info("rstan")
:
- Session info ---------------------------------------------------------------------------------------------------------------
setting value
version R version 3.6.3 (2020-02-29)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz America/New_York
date 2020-07-12
- Packages -------------------------------------------------------------------------------------------------------------------
! package * version date lib source
assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.3)
backports 1.1.7 2020-05-13 [1] CRAN (R 3.6.3)
BH 1.72.0-3 2020-01-08 [1] CRAN (R 3.6.2)
callr 3.4.3 2020-03-28 [1] CRAN (R 3.6.3)
checkmate 2.0.0 2020-02-06 [1] CRAN (R 3.6.3)
cli 2.0.2 2020-02-28 [1] CRAN (R 3.6.3)
colorspace 1.4-1 2019-03-18 [1] CRAN (R 3.6.3)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.3)
curl 4.3 2019-12-02 [1] CRAN (R 3.6.3)
desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.3)
digest 0.6.25 2020-02-23 [1] CRAN (R 3.6.3)
ellipsis 0.3.1 2020-05-15 [1] CRAN (R 3.6.3)
evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.3)
fansi 0.4.1 2020-01-08 [1] CRAN (R 3.6.3)
farver 2.0.3 2020-01-16 [1] CRAN (R 3.6.3)
ggplot2 * 3.3.2 2020-06-19 [1] CRAN (R 3.6.3)
glue 1.4.1 2020-05-13 [1] CRAN (R 3.6.3)
gridExtra * 2.3 2017-09-09 [1] CRAN (R 3.6.3)
gtable * 0.3.0 2019-03-25 [1] CRAN (R 3.6.3)
inline 0.3.15 2018-05-18 [1] CRAN (R 3.6.3)
isoband 0.2.2 2020-06-20 [1] CRAN (R 3.6.3)
jsonlite 1.7.0 2020-06-25 [1] CRAN (R 3.6.3)
labeling 0.3 2014-08-23 [1] CRAN (R 3.6.0)
lattice 0.20-41 2020-04-02 [1] CRAN (R 3.6.3)
lifecycle 0.2.0 2020-03-06 [1] CRAN (R 3.6.3)
loo 2.3.0 2020-07-07 [1] CRAN (R 3.6.3)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.3)
MASS 7.3-51.6 2020-04-26 [1] CRAN (R 3.6.3)
Matrix * 1.2-18 2019-11-27 [2] CRAN (R 3.6.3)
matrixStats 0.56.0 2020-03-13 [1] CRAN (R 3.6.3)
mgcv 1.8-31 2019-11-09 [2] CRAN (R 3.6.3)
munsell 0.5.0 2018-06-12 [1] CRAN (R 3.6.3)
nlme 3.1-148 2020-05-24 [1] CRAN (R 3.6.3)
pillar 1.4.6 2020-07-10 [1] CRAN (R 3.6.3)
pkgbuild 1.0.8 2020-05-07 [1] CRAN (R 3.6.3)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.3)
pkgload 1.1.0 2020-05-29 [1] CRAN (R 3.6.3)
praise 1.0.0 2015-08-11 [1] CRAN (R 3.6.3)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.6.3)
processx 3.4.3 2020-07-05 [1] CRAN (R 3.6.3)
ps 1.3.3 2020-05-08 [1] CRAN (R 3.6.3)
R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.3)
RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 3.6.0)
Rcpp * 1.0.5 2020-07-06 [1] CRAN (R 3.6.3)
RcppEigen 0.3.3.7.0 2019-11-16 [1] CRAN (R 3.6.3)
D RcppParallel 5.0.2 2020-06-24 [1] CRAN (R 3.6.3)
rlang * 0.4.6 2020-05-02 [1] CRAN (R 3.6.3)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.3)
rstan * 2.21.1 2020-07-08 [1] CRAN (R 3.6.3)
rstudioapi 0.11 2020-02-07 [1] CRAN (R 3.6.3)
scales 1.1.1 2020-05-11 [1] CRAN (R 3.6.3)
StanHeaders * 2.21.0-5 2020-06-09 [1] CRAN (R 3.6.3)
testthat 2.3.2 2020-03-02 [1] CRAN (R 3.6.3)
tibble * 3.0.2 2020-07-07 [1] CRAN (R 3.6.3)
utf8 1.1.4 2018-05-24 [1] CRAN (R 3.6.3)
V8 3.2.0 2020-06-19 [1] CRAN (R 3.6.3)
vctrs 0.3.1 2020-06-05 [1] CRAN (R 3.6.3)
viridisLite 0.3.0 2018-02-01 [1] CRAN (R 3.6.3)
withr 2.2.0 2020-04-20 [1] CRAN (R 3.6.3)
[1] C:/Users/micha/OneDrive/Documents/R/win-library/3.6
[2] C:/Program Files/R/R-3.6.3/library
D -- DLL MD5 mismatch, broken installation.
My main questions are: (1) how to fix this issue or alternatively (2) is it better to update R/Rstan and try to solve the original problems. Thank you in advance!