I am teaching Stan and many of my students are getting the following error when following the RStan Getting Started guide:
remove.packages("rstan")
if (file.exists(".RData")) file.remove(".RData")
# Close all RStudio sessions
# Open RStudio
# To install rstan, run the following code
install.packages("rstan", repos = c('https://stan-dev.r-universe.dev', getOption("repos")))
# Examine if rstan is working (there is no warning)
example(stan_model, package = "rstan", run.dontrun = TRUE)
Error in compileCode(f, code, language = language, verbose = verbose) :
Users/hatoo/AppData/Local/R/win-library/4.3/StanHeaders/include/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp:22:56: required from 'double stan::mcmc::dense_e_metric<Model, BaseRNG>::T(stan::mcmc::dense_e_point&) [with Model = model7a7c1af36495__namespace::model7a7c1af36495_; BaseRNG = boost::random::mixmax_engine<17, 36, 0>]'
C:/Users/hatoo/AppData/Local/R/win-library/4.3/StanHeaders/include/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp:21:10: required from here
C:/Users/hatoo/AppData/Local/R/win-library/4.3/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:654:74: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits<double>::type' {aka '__m128d'} [-Wignored-attributes]
654 | return internal::first_aligned<int(unpacket_traits<DefaultPacketType>::alignment),Derived>(m);
| ^~~~~~~~~
make: *** [C:/PROGRA~1/R/R-43~1.0/etc/x64/Makeconf:272: file7a7cfee76d3.o
Error in sink(type = "output") : invalid connection
This is happening with fresh installations of R 4.5.0 (with RTools 45), or with 4.4.3 (with RTools 44), or with R 4.3.0 (with RTools 43) on Windows OS.
Some more information that might be relevant:
- At least for some I can confirm that their R library is not installed on some cloud drive.
- This didn’t happen last year (🤷♂️)
My students and I would be grateful for any help provided!