Installation of RStan probelm the pkgbuild package don't gets installed

Hi I am trying to follow the instructions from :

but when I get the point of:
pkgbuild::has_build_tools(debug = TRUE)

I don’t get the TRUE, so
the pop-up didn’t appear to install Rtools. so the installation never get completed…

pkgbuild::has_build_tools(debug = TRUE)
Error in loadNamespace(name) : there is no package called ‘pkgbuild’

any help?

Thanks in advance.
Francisco
see below the information have asked:

If your question relates to installation please provide the following information:

  • Operating System
    Windows Server 2016 Data center:64-bit
  • RStan Version
    rstan (Version 2.17.2, GitRev: 2e1f913d3ca3)
  • Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))

Error in file(con, “r”) : cannot open the connection
In addition: Warning message:
In file(con, “r”) :
cannot open file ‘C:/Users/fporquillo/Documents/.R/Makevars’: No such file or directory

  • Output of devtools::session_info("rstan")

Session info --------------------------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.4.3 (2017-11-30)
system x86_64, mingw32
ui RStudio (1.1.463)
language (EN)
collate English_United States.1252
tz Europe/London
date 2019-12-03

Packages ------------------------------------------------------------------------------------------------------------------------------------------
package * version date source
assertthat 0.2.0 2017-04-11 CRAN (R 3.4.3)
BH 1.69.0-1 2019-01-07 CRAN (R 3.4.4)
cli 1.0.0 2017-11-05 CRAN (R 3.4.3)
colorspace 1.3-2 2016-12-14 CRAN (R 3.4.3)
crayon 1.3.4 2017-09-16 CRAN (R 3.4.3)
dichromat 2.0-0 2013-01-24 CRAN (R 3.4.1)
digest 0.6.13 2017-12-14 CRAN (R 3.4.3)
ggplot2 * 2.2.1 2016-12-30 CRAN (R 3.4.3)
graphics * 3.4.3 2018-01-10 local
grDevices * 3.4.3 2018-01-10 local
grid 3.4.3 2018-01-10 local
gridExtra 2.3 2017-09-09 CRAN (R 3.4.3)
gtable 0.2.0 2016-02-26 CRAN (R 3.4.3)
inline 0.3.14 2015-04-13 CRAN (R 3.4.3)
labeling 0.3 2014-08-23 CRAN (R 3.4.1)
lattice * 0.20-35 2017-03-25 CRAN (R 3.4.3)
lazyeval 0.2.1 2017-10-29 CRAN (R 3.4.3)
magrittr 1.5 2014-11-22 CRAN (R 3.4.3)
MASS 7.3-48 2017-12-25 CRAN (R 3.4.3)
Matrix 1.2-12 2017-11-20 CRAN (R 3.4.3)
methods * 3.4.3 2018-01-10 local
munsell 0.4.3 2016-02-13 CRAN (R 3.4.3)
pillar 1.0.1 2017-11-27 CRAN (R 3.4.3)
plyr 1.8.4 2016-06-08 CRAN (R 3.4.3)
R6 2.2.2 2017-06-17 CRAN (R 3.3.2)
RColorBrewer 1.1-2 2014-12-07 CRAN (R 3.4.1)
Rcpp 1.0.1 2019-03-17 CRAN (R 3.4.4)
RcppEigen 0.3.3.3.1 2017-11-20 CRAN (R 3.4.3)
reshape2 1.4.3 2017-12-11 CRAN (R 3.4.3)
rlang 0.1.6 2017-12-21 CRAN (R 3.4.3)
rstan * 2.17.2 2017-12-21 CRAN (R 3.4.3)
scales 0.5.0 2017-08-24 CRAN (R 3.4.3)
StanHeaders * 2.17.1 2017-12-20 CRAN (R 3.4.3)
stats * 3.4.3 2018-01-10 local
stats4 3.4.3 2018-01-10 local
stringi 1.1.6 2017-11-17 CRAN (R 3.4.2)
stringr 1.2.0 2017-02-18 CRAN (R 3.4.3)
tibble 1.4.1 2017-12-25 CRAN (R 3.4.3)
tools 3.4.3 2018-01-10 local
utf8 1.1.2 2017-12-14 CRAN (R 3.4.3)
utils * 3.4.3 2018-01-10 local
viridisLite 0.2.0 2017-03-24 CRAN (R 3.4.3)

Just do install.packages("pkgbuild") first. That happens automatically if you install from CRAN (which you should almost always be doing) but not if you install from GitHub.

Thanks,

I got the following:

install.packages(“pkgbuild”)
Warning in install.packages :
package ‘pkgbuild’ is not available (for R version 3.4.3)
pkgbuild::has_build_tools(debug = TRUE)
Error in loadNamespace(name) : there is no package called ‘pkgbuild’

Yeah, R 3.4.3 is too old. You can do

install.packages("https://cran.r-project.org/bin/windows/contrib/3.5/pkgbuild_1.0.6.zip", repos = NULL)

but there will be some other error about a missing package that I can’t remember that has to be fixed first.

ok, What version Do you recomend to install ?
3.6.1(latest 05/07/2017 or 3.5.3 11/03/2019) or other one?

Either of those is fine

Thanks I have done that,

now when I am trying to run the Stan model I get :

fit ← stan(file = ‘8schools.stan’, data = schools_dat)
Error in system(cmd, intern = !verbose) :
‘C:/PROGRA~1/Microsoft/R’ not found
Error in sink(type = “output”) : invalid connection

But pkgbuild::has_build_tools(debug = TRUE) is TRUE?

Yes, but if I do all over again asked me to install again.

And

example(cxxfunction, package = "inline", run.dontrun = TRUE)

?