Error: Path 'C:/~' does not appear to be inside a project or package

Operating System: Windows 7
Interface Version: rstan 2.18.2
Compiler/Toolkit: rstantools1.5.1

I’m trying to replicate the following tutorial Step by step guide for creating a package that depends on RStan, but by running the next command line:

> library("rstantools")
This is rstantools version 1.5.1
> rstan_package_skeleton(path = 'rstanlm')
Creating package skeleton for package: rstanlm
Running usethis::create_package ...
Warning: `recursive` is deprecated, please use `recurse` instead
✔ Creating 'rstanlm/'
✔ Setting active project to 'C:/Users/USER/Documents/rstanlm'
Warning: `recursive` is deprecated, please use `recurse` instead
✔ Creating 'R/'
✔ Writing 'DESCRIPTION'
Package: rstanlm
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R (parsed):
    * First Last <first.last@example.com> [aut, cre] (<https://orcid.org/YOUR-ORCID-ID>)
Description: What the package does (one paragraph).
License: What license it uses
Depends:
    methods,
    R (>= 3.4.0),
    Rcpp (>= 1.0.1)
Imports:
    rstan (>= 2.18.2),
    rstantools (>= 1.5.1)
LinkingTo:
    BH (>= 1.69.0-1),
    Rcpp (>= 1.0.1),
    RcppEigen (>= 0.3.3.5.0),
    rstan (>= 2.18.2),
    StanHeaders (>= 2.18.1)
Encoding: UTF-8
LazyData: true
NeedsCompilation: yes
SystemRequirements: GNU make
✔ Writing 'NAMESPACE'
✔ Writing 'rstanlm.Rproj'
✔ Adding '.Rproj.user' to '.gitignore'
✔ Adding '^rstanlm\\.Rproj$', '^\\.Rproj\\.user$' to '.Rbuildignore'
✔ Setting active project to '<no active project>'
Error: Path 'C:/Users/USER/Documents/' does not appear to be inside a project or package.

this error is generated, Error: Path ‘C:/Users/USER/Documents/’ does not appear to be inside a project or package.

> devtools::session_info("rstan")
- Session info ----------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.6.0 (2019-04-26)
 os       Windows 7 x64 SP 1          
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  Spanish_Colombia.1252       
 ctype    Spanish_Colombia.1252       
 tz       America/Bogota              
 date     2019-05-19                  

- Packages --------------------------------------------------------------------------------------------------
 package      * version   date       lib source        
 assertthat     0.2.1     2019-03-21 [1] CRAN (R 3.6.0)
 backports      1.1.4     2019-04-10 [1] CRAN (R 3.6.0)
 BH             1.69.0-1  2019-01-07 [1] CRAN (R 3.6.0)
 callr          3.2.0     2019-03-15 [1] CRAN (R 3.6.0)
 checkmate      1.9.3     2019-05-03 [1] CRAN (R 3.6.0)
 cli            1.1.0     2019-03-19 [1] CRAN (R 3.6.0)
 colorspace     1.4-1     2019-03-18 [1] CRAN (R 3.6.0)
 crayon         1.3.4     2017-09-16 [1] CRAN (R 3.6.0)
 desc           1.2.0     2018-05-01 [1] CRAN (R 3.6.0)
 digest         0.6.18    2018-10-10 [1] CRAN (R 3.6.0)
 fansi          0.4.0     2018-10-05 [1] CRAN (R 3.6.0)
 ggplot2        3.1.1     2019-04-07 [1] CRAN (R 3.6.0)
 glue           1.3.1     2019-03-12 [1] CRAN (R 3.6.0)
 gridExtra      2.3       2017-09-09 [1] CRAN (R 3.6.0)
 gtable         0.3.0     2019-03-25 [1] CRAN (R 3.6.0)
 inline         0.3.15    2018-05-18 [1] CRAN (R 3.6.0)
 labeling       0.3       2014-08-23 [1] CRAN (R 3.6.0)
 lattice        0.20-38   2018-11-04 [2] CRAN (R 3.6.0)
 lazyeval       0.2.2     2019-03-15 [1] CRAN (R 3.6.0)
 loo            2.1.0     2019-03-13 [1] CRAN (R 3.6.0)
 magrittr       1.5       2014-11-22 [1] CRAN (R 3.6.0)
 MASS           7.3-51.4  2019-03-31 [2] CRAN (R 3.6.0)
 Matrix         1.2-17    2019-03-22 [2] CRAN (R 3.6.0)
 matrixStats    0.54.0    2018-07-23 [1] CRAN (R 3.6.0)
 mgcv           1.8-28    2019-03-21 [2] CRAN (R 3.6.0)
 munsell        0.5.0     2018-06-12 [1] CRAN (R 3.6.0)
 nlme           3.1-139   2019-04-09 [2] CRAN (R 3.6.0)
 pillar         1.4.0     2019-05-11 [1] CRAN (R 3.6.0)
 pkgbuild       1.0.3     2019-03-20 [1] CRAN (R 3.6.0)
 pkgconfig      2.0.2     2018-08-16 [1] CRAN (R 3.6.0)
 plyr           1.8.4     2016-06-08 [1] CRAN (R 3.6.0)
 prettyunits    1.0.2     2015-07-13 [1] CRAN (R 3.6.0)
 processx       3.3.1     2019-05-08 [1] CRAN (R 3.6.0)
 ps             1.3.0     2018-12-21 [1] CRAN (R 3.6.0)
 R6             2.4.0     2019-02-14 [1] CRAN (R 3.6.0)
 RColorBrewer   1.1-2     2014-12-07 [1] CRAN (R 3.6.0)
 Rcpp           1.0.1     2019-03-17 [1] CRAN (R 3.6.0)
 RcppEigen      0.3.3.5.0 2018-11-24 [1] CRAN (R 3.6.0)
 reshape2       1.4.3     2017-12-11 [1] CRAN (R 3.6.0)
 rlang          0.3.4     2019-04-07 [1] CRAN (R 3.6.0)
 rprojroot      1.3-2     2018-01-03 [1] CRAN (R 3.6.0)
 rstan          2.18.2    2018-11-07 [1] CRAN (R 3.6.0)
 scales         1.0.0     2018-08-09 [1] CRAN (R 3.6.0)
 StanHeaders    2.18.1    2019-01-28 [1] CRAN (R 3.6.0)
 stringi        1.4.3     2019-03-12 [1] CRAN (R 3.6.0)
 stringr        1.4.0     2019-02-10 [1] CRAN (R 3.6.0)
 tibble         2.1.1     2019-03-16 [1] CRAN (R 3.6.0)
 utf8           1.1.4     2018-05-24 [1] CRAN (R 3.6.0)
 vctrs          0.1.0     2018-11-29 [1] CRAN (R 3.6.0)
 viridisLite    0.3.0     2018-02-01 [1] CRAN (R 3.6.0)
 withr          2.1.2     2018-03-15 [1] CRAN (R 3.6.0)
 zeallot        0.1.0     2018-01-28 [1] CRAN (R 3.6.0)

[1] C:/Users/USER/Documents/R/win-library/3.6
[2] C:/Program Files/R/R-3.6.0/library

someone could help me.

1 Like

Not sure, but you want to install this version of rstantools instead

install.packages("https://github.com/stan-dev/rstantools/archive/mlysy-rstantools_patch.tar.gz", 
                 repos = NULL)
3 Likes

Thank you very much my friend works perfectly, you do not know what you saved me from.

Well, we created some extra work for you by not releasing a new rstantools in X months, so let’s call it even.

Was having the same problem on Mac, just FYI.

I am having difficulties in building packages for third party people. How can I setup dependencies of a software in a package from a source gz file? Is there any release I can point the remote to in the DESCRIPTION file? Do the third party user needs to install this patch as well to install my package based on Stan?

Is there any plan to update the CRAN rstantools in a way to decrease the probability of errors in the installation phase?

With rstantools version from Github my colleague gets

/stornext/System/data/apps/gcc/gcc-9.1.0/bin/g++ -std=gnu++14 -I"/stornext/System/data/apps/R/openBLAS/R-3.6.1/lib64/R/include" -DNDEBUG -I"../inst/include" -I"/stornext/Home/data/allstaff/t/thomas.e/R/x86_64-pc-linux-gnu-library/3.6/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -I"/stornext/Home/data/allstaff/t/thomas.e/R/x86_64-pc-linux-gnu-library/3.6/BH/include" -I"/stornext/Home/data/allstaff/t/thomas.e/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/stornext/Home/data/allstaff/t/thomas.e/R/x86_64-pc-linux-gnu-library/3.6/RcppEigen/include" -I"/stornext/Home/data/allstaff/t/thomas.e/R/x86_64-pc-linux-gnu-library/3.6/StanHeaders/include" -I/usr/local/include  -fpic  -g -O2  -O3 -DSTAN_THREADS -pthread -c stanExports_negBinomial_MPI.cc -o stanExports_negBinomial_MPI.o
In file included from stanExports_negBinomial_MPI.cc:5:
stanExports_negBinomial_MPI.h:20:10: fatal error: rstan/rstaninc.hpp: No such file or directory
   20 | #include <rstan/rstaninc.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~
 

“The header is in the rstan directory but not in the directories passed to the compiler. Not sure how to update rstan and StanHeaders to match this version of rstantools.”

Furthermore he says:

“I tried the mlysy-rstantools_patch.tar.gz package and your package still fails to compile with the missing header.”

Its sessionInfo is

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /stornext/System/data/tools/openBLAS/openBLAS-0.3.6-gcc-9.1.0/lib/libopenblas_haswellp-r0.3.6.so

locale:
[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] rstantools_2.0.0      rstan_2.19.2          ggplot2_3.2.0        
[4] StanHeaders_2.18.1-10

loaded via a namespace (and not attached):
[1] Rcpp_1.0.2         compiler_3.6.1     pillar_1.4.2       prettyunits_1.0.2 
 [5] remotes_2.1.0      tools_3.6.1        testthat_2.2.1     digest_0.6.20     
 [9] pkgbuild_1.0.4     pkgload_1.0.2      memoise_1.1.0      tibble_2.1.3      
[13] gtable_0.3.0       pkgconfig_2.0.2    rlang_0.4.0        cli_1.1.0         
[17] rstudioapi_0.10    parallel_3.6.1     curl_4.0           loo_2.1.0         
[21] gridExtra_2.3      dplyr_0.8.3        withr_2.1.2        desc_1.2.0        
[25] fs_1.3.1           devtools_2.1.0     stats4_3.6.1       tidyselect_0.2.5  
[29] rprojroot_1.3-2    grid_3.6.1         inline_0.3.15      glue_1.3.1        
[33] R6_2.4.0           processx_3.4.1     sessioninfo_1.1.1  purrr_0.3.2       
[37] callr_3.3.1        magrittr_1.5       matrixStats_0.54.0 backports_1.1.4   
[41] scales_1.0.0       ps_1.3.0           usethis_1.5.1      assertthat_0.2.1  
[45] colorspace_1.4-1   lazyeval_0.2.2     munsell_0.5.0      crayon_1.3.4      

I built the package with R3.6.0 and my sessionInfo has the same rstan rstantools version as his

You can just install rstantools from GitHub now to get the new functions.