Cannot load dll from temporary directory when using Stan

Hi all,

I am running into problems reading the dll created by stan() in my temporary directory. I have read/write permissions and have changed folder locations, but it seems to be that a firewall (that I don’t control) on my network is preventing dyn.load() from reading a dll from my temporary directory. If I copy the dll to a new location, I can load the dll just fine. Is there a way to direct Stan to a new temporary directory after opening R? This is the only way I can think about solving this problem.

  • Operating System: Windows 10
  • RStan Version 2.19
  • Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))
  • Output of devtools::session_info("rstan")
    ─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────────
    setting value
    version R version 3.6.1 (2019-07-05)
    os Windows 10 x64
    system x86_64, mingw32
    ui RStudio
    language (EN)
    collate English_United States.1252
    ctype English_United States.1252
    tz America/Chicago
    date 2019-12-18

─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date lib source
assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.1)
backports 1.1.4 2019-04-10 [1] CRAN (R 3.5.3)
BH 1.69.0-1 2019-01-07 [1] CRAN (R 3.5.2)
callr 3.4.0 2019-12-09 [1] CRAN (R 3.6.1)
checkmate 1.9.4 2019-07-04 [1] CRAN (R 3.6.1)
cli 2.0.0 2019-12-09 [1] CRAN (R 3.6.1)
colorspace 1.4-1 2019-03-18 [1] CRAN (R 3.5.3)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.1)
desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.1)
digest 0.6.21 2019-09-20 [1] CRAN (R 3.5.3)
ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.1)
fansi 0.4.0 2018-10-05 [1] CRAN (R 3.6.1)
ggplot2 * 3.2.1 2019-08-10 [1] CRAN (R 3.5.3)
glue 1.3.1 2019-03-12 [1] CRAN (R 3.5.3)
gridExtra * 2.3 2017-09-09 [1] CRAN (R 3.5.0)
gtable 0.3.0 2019-03-25 [1] CRAN (R 3.6.1)
inline 0.3.15 2018-05-18 [1] CRAN (R 3.5.3)
labeling 0.3 2014-08-23 [1] CRAN (R 3.5.0)
lattice 0.20-38 [2]
lazyeval 0.2.2 2019-03-15 [1] CRAN (R 3.5.3)
loo 2.1.0 2019-03-13 [1] CRAN (R 3.5.3)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.0)
MASS 7.3-51.4 2019-04-26 [1] CRAN (R 3.5.3)
Matrix * 1.2-17 2019-03-22 [1] CRAN (R 3.5.3)
matrixStats 0.55.0 2019-09-07 [1] CRAN (R 3.5.3)
mgcv 1.8-29 2019-09-20 [1] CRAN (R 3.5.3)
munsell 0.5.0 2018-06-12 [1] CRAN (R 3.5.3)
nlme 3.1-141 2019-08-01 [1] CRAN (R 3.5.0)
pillar 1.4.2 2019-06-29 [1] CRAN (R 3.5.3)
pkgbuild 1.0.5 2019-08-26 [1] CRAN (R 3.5.3)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.5.3)
plyr 1.8.4 2016-06-08 [1] CRAN (R 3.5.0)
prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.0)
processx 3.4.1 2019-07-18 [1] CRAN (R 3.5.3)
ps 1.3.0 2018-12-21 [1] CRAN (R 3.5.3)
R6 2.4.0 2019-02-14 [1] CRAN (R 3.5.3)
RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 3.5.0)
Rcpp * 1.0.2 2019-07-25 [1] CRAN (R 3.5.3)
RcppEigen 0.3.3.5.0 2018-11-24 [1] CRAN (R 3.5.3)
reshape2 * 1.4.3 2017-12-11 [1] CRAN (R 3.5.0)
rlang 0.4.0 2019-06-25 [1] CRAN (R 3.5.3)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.0)
rstan * 2.19.2 2019-07-09 [1] CRAN (R 3.5.3)
scales 1.0.0 2018-08-09 [1] CRAN (R 3.5.3)
StanHeaders * 2.19.0 2019-09-07 [1] CRAN (R 3.5.3)
stringi 1.4.3 2019-03-12 [1] CRAN (R 3.5.3)
stringr * 1.4.0 2019-02-10 [1] CRAN (R 3.5.3)
tibble * 2.1.3 2019-06-06 [1] CRAN (R 3.5.3)
utf8 1.1.4 2018-05-24 [1] CRAN (R 3.5.3)
vctrs 0.2.0 2019-07-05 [1] CRAN (R 3.5.3)
viridisLite 0.3.0 2018-02-01 [1] CRAN (R 3.5.0)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.0)
zeallot 0.1.0 2018-01-28 [1] CRAN (R 3.5.3)

If you are reporting a bug (thank you!) please use the issue tracker (github.com/stan-dev/rstan/issues) instead of the forums.

help(Startup) has instructions for how to change the temporary directory before R is stared.

I have tried that method, by setting tempdir = “temp/file/path”, but that is also flagged by whatever is blocking my access to the temporary directory.

I think you will have to deal with the antivirus program directly then. There is no option to compile to a non-temporary directory.

Thanks. That is what I figured, just wanted to see if there was a way to set the temp directory after initializing R.