DOI-USGS / streamMetabolizer

streamMetabolizer uses inverse modeling to estimate aquatic metabolism (photosynthesis and respiration) from time series data on dissolved oxygen, water temperature, depth, and light.
http://usgs-r.github.io/streamMetabolizer/
Other
37 stars 22 forks source link

Bayes metab issues #418

Open miralha opened 1 year ago

miralha commented 1 year ago

I have tried several times to remove and reinstall rstan and stanheaders packages and I keep getting the following errors: When trying to run the example:

rstan_options(auto_write = TRUE) example(stan_model, run.dontrun = TRUE)

Compilation ERROR, function(s)/method(s) not created! Error in compileCode(f, code, language = language, verbose = verbose) : /bin/sh: line 1: C:/rtools42/mingw64/bin/g++: No such file or directorymake: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:260: file2b8c2ce291.o] Error 127

When trying to run the metab function:

mm <- metab(bayes_specs, data=dat1)

Timing stopped at: 0.95 0.18 1.5 Warning message: In metab_fun(specs = specs, data = data, data_daily = data_daily, : Modeling failed Errors: invalid connection

How can I fix this?

aappling-usgs commented 1 year ago

Is it possible your compilation tools aren't up to snuff? Looks like it can't find C:/rtools42/mingw64/bin/g++ (a compiler). Start at the rstan wiki page for the most up-to-date rstan installation instructions, which differ by operating system. Specifically, looks like you probably need RTools for your Windows system: https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows, and then will need to reinstall those packages (again!) from mc-stan.org:

install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))