RStan下载,应用

Issue Description: I encountered installation and compilation issues while trying to use rstan, particularly with the RcppEigen package, which fails to install. The error message indicates “no DLL was created,” and the compilation process ends with a non-zero exit status. Additionally, when running rstan, I receive the error “Eigen.hpp: No such file or directory,” suggesting that rstan is unable to locate the relevant files from the Eigen library.

Methods I Have Tried:

  1. Checked RTools installation: I used pkgbuild::has_build_tools(debug = TRUE) to check whether RTools is correctly installed, and the status is confirmed.
  2. Reinstalled RcppEigen: I tried multiple times to remove and reinstall RcppEigen, including using the GitHub development version, but the issue persists.
  3. Installed binary versions: I attempted to install the binary versions of RcppEigen, StanHeaders, and rstan, but still encountered compilation issues.
  4. Checked Eigen path: I confirmed that Eigen.hpp was missing in the installed path of RcppEigen, and I manually downloaded the Eigen library, attempting to set the path, but the issue remained.
  5. Enabled C++14 support: I set Sys.setenv(USE_CXX14 = 1) to enable C++14 support and recompiled the relevant packages, but the problem is still unresolved.

System Environment:

  • Operating System: Windows 10
  • R Version: 4.0.2
  • RTools is installed and compatible with my R version.
    Code to List Installed Packages Related to rstan:
model_pre_new = stan(model_code = bayestan,data=bayestan_data,warmup=10000,iter=30000,
                     chains=1,cores=24,
                     refresh=300
)

Error Message:

Error in compilecode(f, code, language = language, verbose = verbose)I#include <stan/math/prim/mat/fun/eigen.hpp>akeconf:229:fi7ea81470f73db.ol Error iError in sink(type -"output"):挺结不对
In file included from c:/users/lenovo/Documents/R/win-library/4.0/rstan/include/rstan_next/stan_fit.hpp:5
from fi1ea81470f73db.cpp:1280:c:/Users/lenovo/pocuments/k/win-library/4.0/rstaninclude/rstan next/stan fit base.hp:s:10: fatal eror: stan/math/prim/mat/fun/eigen.hp: No such file or directory
compilation terminated,make: *** [C:/PROGRA-1/R/R-40-1.2/etc/x64/M

If you’re struggling with installing RStan due to RcppEigen, I would suggest trying to install CmdStanR, which doesn’t have that dependency.

Otherwise, in order to install RStan, you’ll have to figure out how to install RcppEigen as it’s a required dependency for RStan. We would’ve just included this all in RStan, but CRAN insisted on the dependency rather than inclusion, which has been a huge install hassle.