# StanHeaders eigen.hpp not found on new RStan install

**URL:** <https://discourse.mc-stan.org/t/stanheaders-eigen-hpp-not-found-on-new-rstan-install/18424>\
**Category:** RStan\
**Tags:** installation, rstan\
**Created:** [October 5, 2020, 10:09pm UTC](https://discourse.mc-stan.org/t/stanheaders-eigen-hpp-not-found-on-new-rstan-install/18424 "2020-10-05T22:09:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Himmelstein](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mark_himmelstein/32/9260_2.png) [@Mark\_Himmelstein](https://discourse.mc-stan.org/u/Mark_Himmelstein)\
**Post date:** [October 5, 2020, 10:09pm UTC](https://discourse.mc-stan.org/t/stanheaders-eigen-hpp-not-found-on-new-rstan-install/18424/1 "2020-10-05T22:09:14Z")

</div>

I have a computationally expensive series of models I need to run and have been given access to a remote workstation on my campus (using LogMeIn), since it’s impractical to run them from my laptop at home. I have admin privileges on the workstation, but I cannot seem to get RStan working (nor can I seem to install it from source). I run the following code:

```
example(stan_model, package = "rstan", run.dontrun = TRUE)

```

I get most of the usual compilation stuff (omitted for space but can include parts if necessary) and it runs through line 372 twice. The second time, the error I get is

```
Compilation ERROR, function(s)/method(s) not created!

Error in compileCode(f, code, language = language, verbose = verbose) : 
  cc1plus.exe: fatal error: \ds.fordham.edu/DFS/Users/mhimmelstein/My Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp: No such file or directorycompilation terminated.make: *** [C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:229: file3e387256459a.o] Error 1

```

I’ve also tried installing RStan from source and that also fails, but I’m not sure if it would help (it goes for a few minutes then has an issue creating a DLL, I already lost the error in my console but can reproduce it if that would help as well, it would just take a few minutes), and saving the packages to the local drive rather than my network drive (I get the same error).

- Operating System : Windows 10
- RStan Version: 2.21.1 (StanHeaders version 2.21.0-6 I believe)
- Output of `writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))`

```
CXX14FLAGS += -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2

```

- Output of `devtools::session_info("rstan")`

```
> devtools::session_info("rstan")
- Session info ---------------------------------------------------------------------------------------------------------
 setting value                       
 version R version 4.0.2 (2020-06-22)
 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-10-05                  

- Packages -------------------------------------------------------------------------------------------------------------
 ! package * version date lib source        
   assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.2)
   backports 1.1.10 2020-09-15 [1] CRAN (R 4.0.2)
   BH 1.72.0-3 2020-01-08 [1] CRAN (R 4.0.0)
   callr 3.4.4 2020-09-07 [1] CRAN (R 4.0.2)
   checkmate 2.0.0 2020-02-06 [1] CRAN (R 4.0.2)
   cli 2.0.2 2020-02-28 [1] CRAN (R 4.0.2)
   colorspace 1.4-1 2019-03-18 [1] CRAN (R 4.0.2)
   crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.2)
   curl 4.3 2019-12-02 [1] CRAN (R 4.0.2)
   desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.2)
   digest 0.6.25 2020-02-23 [1] CRAN (R 4.0.2)
   ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.2)
   evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.2)
   fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.2)
   farver 2.0.3 2020-01-16 [1] CRAN (R 4.0.2)
   ggplot2 * 3.3.2 2020-06-19 [1] CRAN (R 4.0.2)
   glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2)
   gridExtra 2.3 2017-09-09 [1] CRAN (R 4.0.2)
   gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.2)
   inline 0.3.16 2020-09-06 [1] CRAN (R 4.0.2)
   isoband 0.2.2 2020-06-20 [1] CRAN (R 4.0.2)
   jsonlite 1.7.1 2020-09-07 [1] CRAN (R 4.0.2)
   labeling 0.3 2014-08-23 [1] CRAN (R 4.0.0)
   lattice 0.20-41 2020-04-02 [2] CRAN (R 4.0.2)
   lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.2)
   loo 2.3.1 2020-07-14 [1] CRAN (R 4.0.2)
   magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.2)
   MASS 7.3-51.6 2020-04-26 [2] CRAN (R 4.0.2)
   Matrix 1.2-18 2019-11-27 [2] CRAN (R 4.0.2)
   matrixStats 0.57.0 2020-09-25 [1] CRAN (R 4.0.2)
   mgcv 1.8-31 2019-11-09 [2] CRAN (R 4.0.2)
   munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.2)
   nlme 3.1-148 2020-05-24 [2] CRAN (R 4.0.2)
   pillar 1.4.6 2020-07-10 [1] CRAN (R 4.0.2)
   pkgbuild 1.1.0 2020-07-13 [1] CRAN (R 4.0.2)
   pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.2)
   pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.2)
   praise 1.0.0 2015-08-11 [1] CRAN (R 4.0.2)
   prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.2)
   processx 3.4.4 2020-09-03 [1] CRAN (R 4.0.2)
   ps 1.3.4 2020-08-11 [1] CRAN (R 4.0.2)
   R6 2.4.1 2019-11-12 [1] CRAN (R 4.0.2)
   RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 4.0.0)
   Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.0.2)
   RcppEigen 0.3.3.7.0 2019-11-16 [1] CRAN (R 4.0.2)
 D RcppParallel 5.0.2 2020-06-24 [1] CRAN (R 4.0.2)
   rlang 0.4.7 2020-07-09 [1] CRAN (R 4.0.2)
   rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.0.2)
   rstan * 2.21.2 2020-07-27 [1] CRAN (R 4.0.2)
   rstudioapi 0.11 2020-02-07 [1] CRAN (R 4.0.2)
   scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.2)
   StanHeaders * 2.21.0-6 2020-08-16 [1] CRAN (R 4.0.2)
   testthat 2.3.2 2020-03-02 [1] CRAN (R 4.0.2)
   tibble 3.0.3 2020-07-10 [1] CRAN (R 4.0.2)
   utf8 1.1.4 2018-05-24 [1] CRAN (R 4.0.2)
   V8 3.2.0 2020-06-19 [1] CRAN (R 4.0.2)
   vctrs 0.3.4 2020-08-29 [1] CRAN (R 4.0.2)
   viridisLite 0.3.0 2018-02-01 [1] CRAN (R 4.0.2)
   withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.2)

[1] \\ds.fordham.edu/DFS/Users/mhimmelstein/My Documents/R/win-library/4.0
[2] C:/Program Files/R/R-4.0.2/library

 D -- DLL MD5 mismatch, broken installation.

```

I’ve seen a few topics on this and I know there have been others with similar issues, but it seemed like there was hope this would be corrected with the latest version of StanHeaders, so I figured it made more sense to open a new topic than build on ones that are possibly out of date/a bit different.

Thanks for any help you’re able to provide.

---

<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:** [October 6, 2020, 12:58am UTC](https://discourse.mc-stan.org/t/stanheaders-eigen-hpp-not-found-on-new-rstan-install/18424/2 "2020-10-06T00:58:09Z")

</div>

> [@Mark\_Himmelstein](#):
>
> `cc1plus.exe: fatal error: \ds.fordham.edu/DFS/Users/mhimmelstein/.../Eigen.hpp: No such file or directory`

These network mounted drives are difficult to deal with (on Windows). What is

```no-highlight
dir(system.file("include", package = "StanHeaders"),
    pattern = "Eigen.hpp$", recursive = TRUE, full.names = TRUE)

```

?

---

<div class="post-metadata">

**Author:** ![Mark\_Himmelstein](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mark_himmelstein/32/9260_2.png) [@Mark\_Himmelstein](https://discourse.mc-stan.org/u/Mark_Himmelstein)\
**Post date:** [October 6, 2020, 1:26am UTC](https://discourse.mc-stan.org/t/stanheaders-eigen-hpp-not-found-on-new-rstan-install/18424/3 "2020-10-06T01:26:27Z")

</div>

> [@bgoodri](#):
>
> ```no-highlight
> dir(system.file("include", package = "StanHeaders"),
> pattern = "Eigen.hpp$", recursive = TRUE, full.names = TRUE)
> 
> ```

```no-highlight
"\\\\ds.fordham.edu/DFS/Users/mhimmelstein/My Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp"

```

For whatever its worth, this is the workstation in my office and I have admin access to the C:\ drive as well, though installing to the C:\ library path

```no-highlight
"C:/Program Files/R/R-4.0.2/library" 

```

Causes the same error with the local path (taken from your suggestion in this thread: [Compilation error stan/math/prim/mat/fun/Eigen.hpp: No such file or directory - #10 by Aidan1](https://discourse.mc-stan.org/t/compilation-error-stan-math-prim-mat-fun-eigen-hpp-no-such-file-or-directory/14083/10))

---

<div class="post-metadata">

**Author:** ![Mark\_Himmelstein](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mark_himmelstein/32/9260_2.png) [@Mark\_Himmelstein](https://discourse.mc-stan.org/u/Mark_Himmelstein)\
**Post date:** [October 6, 2020, 2:31am UTC](https://discourse.mc-stan.org/t/stanheaders-eigen-hpp-not-found-on-new-rstan-install/18424/4 "2020-10-06T02:31:24Z")

</div>

SOLVED! Though no idea how generalizable this would be.

I migrated **all** of my packages from the remote drive to the local drive and I can get the example model to run.

If there’s any troubleshooting I can do to help you figure out which packages it was I’m happy to do it, but it didn’t work when I just moved StanHeaders, BH, Rcpp, and RcppEigen. I also tried it with rstan itself in addition to those four and that didn’t do it, so presumably its another package or packages that needs to be local?

---

<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:** [October 7, 2020, 2:53am UTC](https://discourse.mc-stan.org/t/stanheaders-eigen-hpp-not-found-on-new-rstan-install/18424/5 "2020-10-07T02:53:17Z")

</div>

I would have guessed StanHeaders, BH, Rcpp, RcppEigen, RcppParallel, and rstan would have been sufficient but it is probably easier to just set `.libPaths()` to prioritize some directory with a canonical Windows path and put all of the non-standard R packages there.

---

<div class="post-metadata">

**Author:** ![Mark\_Himmelstein](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mark_himmelstein/32/9260_2.png) [@Mark\_Himmelstein](https://discourse.mc-stan.org/u/Mark_Himmelstein)\
**Post date:** [October 7, 2020, 3:13am UTC](https://discourse.mc-stan.org/t/stanheaders-eigen-hpp-not-found-on-new-rstan-install/18424/6 "2020-10-07T03:13:38Z")

</div>

Yeah that’s the plan, but if I have a chance I’ll test if moving RcppParallel too would have worked.
