# R 4.0 Running rstan from windows 10, rstan can't recognise file path

**URL:** <https://discourse.mc-stan.org/t/r-4-0-running-rstan-from-windows-10-rstan-cant-recognise-file-path/15963>\
**Category:** RStan\
**Created:** [June 15, 2020, 5:36pm UTC](https://discourse.mc-stan.org/t/r-4-0-running-rstan-from-windows-10-rstan-cant-recognise-file-path/15963 "2020-06-15T17:36:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elina](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/elina/32/8362_2.png) [@elina](https://discourse.mc-stan.org/u/elina)\
**Post date:** [June 15, 2020, 5:36pm UTC](https://discourse.mc-stan.org/t/r-4-0-running-rstan-from-windows-10-rstan-cant-recognise-file-path/15963/1 "2020-06-15T17:36:45Z")

</div>

Hey! I am new to R. I hope I’m not creating any noise. But I’m really struggling with this.  
When I execute rstan, I get following errors:  
Error in file(con, “r”) : cannot open the connection  
Error in sink(type = “output”) : invalid connection

```no-highlight
When I run example(stan_model, package = "rstan", run.dontrun = TRUE) this is what I see: 
..Compilation argument:
 C:/PROGRA~1/R/R-40~1.1/bin/x64/R CMD SHLIB file33882a34876.cpp 2> file33882a34876.cpp.err.txt 
"C:/rtools40/mingw64/bin/"g++ -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.1/include" -DNDEBUG -I"C:/Program Files/R/R-4.0.1/library/Rcpp/include/" -I"C:/Program Files/R/R-4.0.1/library/RcppEigen/include/" -I"C:/Program Files/R/R-4.0.1/library/RcppEigen/include/unsupported" -I"C:/Program Files/R/R-4.0.1/library/BH/include" -I"C:/Users/Julia Stocker/Documents/R/win-library/4.0/StanHeaders/include/src/" -I"C:/Users/Julia Stocker/Documents/R/win-library/4.0/StanHeaders/include/" -I"C:/Users/Julia Stocker/Documents/R/win-library/4.0/rstan/include" -DEIGEN_NO_DEBUG -D_REENTRANT -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -include stan/math/prim/mat/fun/Eigen.hpp -std=c++1y -march=core2 -include C:/Users/Julia Stocker/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp -I "C:/Users/Julia Stocker/Documents/R/win-library/4.0/StanHeaders/include" -I "C:/Program Files/R/R-4.0.1/library/RcppEigen/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c file33882a34876.cpp -o file33882a34876.o
g++.exe: error: Stocker/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp: No such file or directory
make: *** [C:/PROGRA~1/R/R-40~1.1/etc/x64/Makeconf:229: file33882a34876.o] Error 1

```

My session information looks like the following:

R version 4.0.1 (2020-06-06)  
Platform: x86\_64-w64-mingw32/x64 (64-bit)  
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:  
[1] LC\_COLLATE=English\_United Kingdom.1252 LC\_CTYPE=English\_United Kingdom.1252  
[3] LC\_MONETARY=English\_United Kingdom.1252 LC\_NUMERIC=C  
[5] LC\_TIME=English\_United Kingdom.1252

attached base packages:  
[1] stats graphics grDevices utils datasets methods base

other attached packages:  
[1] aida\_0.2.1 rstan\_2.19.3 StanHeaders\_2.21.0-5 bayesplot\_1.7.2  
[5] tidybayes\_2.0.3 brms\_2.13.0 Rcpp\_1.0.4.6 forcats\_0.5.0  
[9] stringr\_1.4.0 dplyr\_1.0.0 purrr\_0.3.4 readr\_1.3.1  
[13] tidyr\_1.1.0 tibble\_3.0.1 ggplot2\_3.3.1 tidyverse\_1.3.0

loaded via a namespace (and not attached):  
[1] nlme\_3.1-148 matrixStats\_0.56.0 fs\_1.4.1 xts\_0.12-0  
[5] lubridate\_1.7.9 threejs\_0.3.3 httr\_1.4.1 nimble\_0.9.1  
[9] tools\_4.0.1 backports\_1.1.7 R6\_2.4.1 DT\_0.13  
[13] DBI\_1.1.0 colorspace\_1.4-1 withr\_2.2.0 prettyunits\_1.1.1  
[17] processx\_3.4.2 tidyselect\_1.1.0 gridExtra\_2.3 Brobdingnag\_1.2-6  
[21] compiler\_4.0.1 cli\_2.0.2 rvest\_0.3.5 arrayhelpers\_1.1-0  
[25] xml2\_1.3.2 shinyjs\_1.1 colourpicker\_1.0 scales\_1.1.1  
[29] dygraphs\_1.1.1.6 mvtnorm\_1.1-1 callr\_3.4.3 ggridges\_0.5.2  
[33] digest\_0.6.25 base64enc\_0.1-3 pkgconfig\_2.0.3 htmltools\_0.4.0  
[37] dbplyr\_1.4.4 fastmap\_1.0.1 htmlwidgets\_1.5.1 rlang\_0.4.6  
[41] readxl\_1.3.1 rstudioapi\_0.11 shiny\_1.4.0.2 svUnit\_1.0.3  
[45] generics\_0.0.2 zoo\_1.8-8 jsonlite\_1.6.1 crosstalk\_1.1.0.1  
[49] gtools\_3.8.2 inline\_0.3.15 magrittr\_1.5 loo\_2.2.0  
[53] Matrix\_1.2-18 munsell\_0.5.0 fansi\_0.4.1 abind\_1.4-5  
[57] lifecycle\_0.2.0 stringi\_1.4.6 pkgbuild\_1.0.8 plyr\_1.8.6  
[61] grid\_4.0.1 blob\_1.2.1 parallel\_4.0.1 promises\_1.1.1  
[65] crayon\_1.3.4 miniUI\_0.1.1.1 lattice\_0.20-41 haven\_2.3.1  
[69] hms\_0.5.3 ps\_1.3.3 knitr\_1.28 pillar\_1.4.4  
[73] igraph\_1.2.5 markdown\_1.1 shinystan\_2.5.0 stats4\_4.0.1  
[77] reshape2\_1.4.4 rstantools\_2.0.0 reprex\_0.3.0 glue\_1.4.1  
[81] RcppParallel\_5.0.1 modelr\_0.1.8 vctrs\_0.3.1 httpuv\_1.5.4  
[85] cellranger\_1.1.0 gtable\_0.3.0 assertthat\_0.2.1 xfun\_0.14  
[89] mime\_0.9 xtable\_1.8-4 broom\_0.5.6 coda\_0.19-3  
[93] later\_1.1.0.1 rsconnect\_0.8.16 shinythemes\_1.1.2 ellipsis\_0.3.1  
[97] bridgesampling\_1.0-0

I don’t have any _makevars_ file. I placed the _.Renviron_ into my home directory.

> Sys.which(“make”)  
> make  
> “C:\rtools40\usr\bin\make.exe”

These are my directories:  
R\_HOME C:/PROGRA~1/R/R-40~1.1  
R\_LIBS\_USER C:/Users/Julia Stocker/Documents/R/win-library/4.0  
R\_USER C:/Users/Julia Stocker/Documents

RTOOLS40\_HOME C:\RBuildTools\4.0  
PATH …C:\RBuildTools\4.0\usr\bin;C:\RBuildTools\4.0\mingw64\bin;C:\RBuildTools\4.0\mingw32\bin;C:\Program Files\R\R-4.0.1\bin\x64;C:\Program Files\RStudio\bin;C:\Program Files\R\R-4.0.1\bin\i386"

I tried solving the issue by adding library(rstan, lib.loc=“C:\Users\Julia Stocker\Documents\R\win-library\4.0”) each time I call rstans library, however the error still prevails.  
I would be very thankful if somebody could help me! I’ve been trying to find a solution for a couple of days now.

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [June 15, 2020, 9:25pm UTC](https://discourse.mc-stan.org/t/r-4-0-running-rstan-from-windows-10-rstan-cant-recognise-file-path/15963/2 "2020-06-15T21:25:30Z")

</div>

You will probably have to install rstan from GitHub to get it to work with StanHeaders\_2.21.0-5

```
remotes::install_github("stan-dev/rstan", subdir = "rstan/rstan", ref = "develop")

```

---

<div class="post-metadata">

**Author:** ![dej505](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@dej505](https://discourse.mc-stan.org/u/dej505)\
**Post date:** [June 16, 2020, 6:49pm UTC](https://discourse.mc-stan.org/t/r-4-0-running-rstan-from-windows-10-rstan-cant-recognise-file-path/15963/3 "2020-06-16T18:49:29Z")

</div>

Sorry, now I am having trouble downloading from github:

> remotes::install\_github(“stan-dev/rstan”, ref = “develop”, subdir = “rstan/rstan”)  
> Downloading GitHub repo stan-dev/rstan@develop  
> stan-dev-rstan-e634309/StanHeaders/inst/include/libsundials: Can’t create ‘\\?\C:\Users\dja606\AppData\Local\Temp\RtmpULLebl\remotes3048581a439\stan-dev-rstan-e634309\StanHeaders\inst\include\libsundials’  
> stan-dev-rstan-e634309/StanHeaders/inst/include/src: Can’t create ‘\\?\C:\Users\dja606\AppData\Local\Temp\RtmpULLebl\remotes3048581a439\stan-dev-rstan-e634309\StanHeaders\inst\include\src’  
> stan-dev-rstan-e634309/StanHeaders/inst/include/stan: Can’t create ‘\\?\C:\Users\dja606\AppData\Local\Temp\RtmpULLebl\remotes3048581a439\stan-dev-rstan-e634309\StanHeaders\inst\include\stan’  
> tar.exe: Error exit delayed from previous errors.  
> “C:\PROGRA~1\Git\cmd\git.exe” clone --depth 1 --no-hardlinks --recurse-submodules --branch develop [GitHub - stan-dev/stan: Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.](https://github.com/stan-dev/stan.git) C:\Users\dja606\AppData\Local\Temp\RtmpULLebl\remotes3048581a439/stan-dev-rstan-e634309/rstan/rstan/…/…/StanHeaders/inst/include/upstream  
> Error: Failed to install ‘rstan’ from GitHub:  
> Command failed (128)  
> In addition: Warning messages:  
> 1: In utils::untar(tarfile, …) :  
> ‘tar.exe -xf “C:\Users\dja606\AppData\Local\Temp\RtmpULLebl\file304833aa1e6b.tar.gz” -C “C:/Users/dja606/AppData/Local/Temp/RtmpULLebl/remotes3048581a439”’ returned error code 1  
> 2: In system(full, intern = TRUE, ignore.stderr = quiet) :  
> running command ‘“C:\PROGRA~1\Git\cmd\git.exe” clone --depth 1 --no-hardlinks --recurse-submodules --branch develop [GitHub - stan-dev/stan: Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.](https://github.com/stan-dev/stan.git) C:\Users\dja606\AppData\Local\Temp\RtmpULLebl\remotes3048581a439/stan-dev-rstan-e634309/rstan/rstan/…/…/StanHeaders/inst/include/upstream’ had status 128
