Bayes modeling not working?
woodwardb1 opened this issue · 4 comments
Description
The error below appears when using data and code that works for a "mle" model and for data and code that used to work for "bayes" model.
The error
Timing stopped at: 0.18 0.06 23.43
Warning message:
In metab_fun(specs = specs, data = data, data_daily = data_daily, :
Modeling failed
Errors:
invalid connection
Code
T4below_mm <- mm_name('bayes') %>%
specs() %>%
metab(Met_calc_data)
Data
Attached
Session info
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.2.1 (2022-06-23 ucrt)
os Windows 10 x64 (build 19044)
system x86_64, mingw32
ui RStudio
language (EN)
collate English_New Zealand.utf8
ctype English_New Zealand.utf8
tz Pacific/Auckland
date 2022-11-04
rstudio 2022.07.2+576 Spotted Wakerobin (desktop)
pandoc NA
─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
! package * version date (UTC) lib source
assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.2.1)
backports 1.4.1 2021-12-13 [1] CRAN (R 4.2.0)
bitops 1.0-7 2021-04-24 [1] CRAN (R 4.2.0)
boot 1.3-28 2021-05-03 [2] CRAN (R 4.2.1)
broom * 1.0.1 2022-08-29 [1] CRAN (R 4.2.1)
cachem 1.0.6 2021-08-19 [1] CRAN (R 4.2.1)
callr 3.7.3 2022-11-02 [1] CRAN (R 4.2.1)
cli * 3.3.0 2022-04-25 [1] CRAN (R 4.2.1)
codetools 0.2-18 2020-11-04 [2] CRAN (R 4.2.1)
colorspace 2.0-3 2022-02-21 [1] CRAN (R 4.2.1)
crayon 1.5.2 2022-09-29 [1] CRAN (R 4.2.1)
data.table * 1.14.4 2022-10-17 [1] CRAN (R 4.2.1)
DBI 1.1.3 2022-06-18 [1] CRAN (R 4.2.1)
deSolve 1.34 2022-10-22 [1] CRAN (R 4.2.1)
devtools 2.4.5 2022-10-11 [1] CRAN (R 4.2.2)
digest 0.6.30 2022-10-18 [1] CRAN (R 4.2.1)
dplyr * 1.0.10 2022-09-01 [1] CRAN (R 4.2.1)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.1)
fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.1)
farver 2.1.1 2022-07-06 [1] CRAN (R 4.2.1)
fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.1)
fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.1)
generics 0.1.3 2022-07-05 [1] CRAN (R 4.2.1)
ggplot2 * 3.3.6 2022-05-03 [1] CRAN (R 4.2.1)
glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.1)
gridExtra 2.3 2017-09-09 [1] CRAN (R 4.2.1)
gtable 0.3.1 2022-09-01 [1] CRAN (R 4.2.1)
hms 1.1.2 2022-08-19 [1] CRAN (R 4.2.1)
htmltools 0.5.3 2022-07-18 [1] CRAN (R 4.2.1)
htmlwidgets 1.5.4 2021-09-08 [1] CRAN (R 4.2.1)
httpuv 1.6.6 2022-09-08 [1] CRAN (R 4.2.1)
inline 0.3.19 2021-05-31 [1] CRAN (R 4.2.1)
labeling 0.4.2 2020-10-20 [1] CRAN (R 4.2.0)
LakeMetabolizer * 1.5.3 2022-10-28 [1] Github (GLEON/LakeMetabolizer@5e42781)
later 1.3.0 2021-08-18 [1] CRAN (R 4.2.1)
lattice 0.20-45 2021-09-22 [2] CRAN (R 4.2.1)
lazyeval 0.2.2 2019-03-15 [1] CRAN (R 4.2.1)
lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.1)
lme4 * 1.1-31 2022-11-01 [1] CRAN (R 4.2.1)
loo 2.5.1 2022-03-24 [1] CRAN (R 4.2.1)
lubridate * 1.8.0 2021-10-07 [1] CRAN (R 4.2.1)
magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.1)
MASS 7.3-57 2022-04-22 [2] CRAN (R 4.2.1)
Matrix * 1.5-1 2022-09-13 [1] CRAN (R 4.2.1)
matrixStats 0.62.0 2022-04-19 [1] CRAN (R 4.2.1)
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.2.1)
mime 0.12 2021-09-28 [1] CRAN (R 4.2.0)
miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.2.1)
minqa 1.2.5 2022-10-19 [1] CRAN (R 4.2.1)
munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.1)
nlme 3.1-160 2022-10-10 [1] CRAN (R 4.2.1)
nloptr 2.0.3 2022-05-26 [1] CRAN (R 4.2.1)
pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.1)
pkgbuild 1.3.1 2021-12-20 [1] CRAN (R 4.2.1)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.1)
pkgload 1.3.1 2022-10-28 [1] CRAN (R 4.2.1)
plyr 1.8.7 2022-03-24 [1] CRAN (R 4.2.1)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.2.1)
processx 3.8.0 2022-10-26 [1] CRAN (R 4.2.1)
profvis 0.3.7 2020-11-02 [1] CRAN (R 4.2.1)
promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.2.1)
ps 1.7.2 2022-10-26 [1] CRAN (R 4.2.1)
purrr 0.3.5 2022-10-06 [1] CRAN (R 4.2.1)
R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.1)
Rcpp 1.0.9 2022-07-08 [1] CRAN (R 4.2.1)
D RcppParallel 5.1.5 2022-01-05 [1] CRAN (R 4.2.1)
RCurl 1.98-1.9 2022-10-03 [1] CRAN (R 4.2.1)
readr * 2.1.3 2022-10-01 [1] CRAN (R 4.2.1)
remotes 2.4.2 2021-11-30 [1] CRAN (R 4.2.1)
rLakeAnalyzer * 1.11.4.1 2019-06-09 [1] CRAN (R 4.2.1)
rlang * 1.0.6 2022-09-24 [1] CRAN (R 4.2.1)
rstan * 2.21.7 2022-09-08 [1] CRAN (R 4.2.1)
rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.1)
scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.1)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.1)
shiny 1.7.3 2022-10-25 [1] CRAN (R 4.2.1)
StanHeaders * 2.21.0-7 2020-12-17 [1] CRAN (R 4.2.1)
streamMetabolizer * 0.12.0 2022-10-31 [1] Github (a5e9bb1)
stringi 1.7.8 2022-07-11 [1] CRAN (R 4.2.1)
stringr 1.4.1 2022-08-20 [1] CRAN (R 4.2.1)
tibble 3.1.8 2022-07-22 [1] CRAN (R 4.2.1)
tidyr * 1.2.1 2022-09-08 [1] CRAN (R 4.2.1)
tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.1)
tzdb 0.3.0 2022-03-28 [1] CRAN (R 4.2.1)
unitted 0.2.9 2022-10-26 [1] Github (appling/unitted@d1f1172)
urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.2.1)
usethis 2.1.6 2022-05-25 [1] CRAN (R 4.2.1)
utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.1)
vctrs 0.5.0 2022-10-22 [1] CRAN (R 4.2.1)
withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.1)
XML 3.99-0.12 2022-10-28 [1] CRAN (R 4.2.1)
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.2.1)
[1] C:/Users/woodwardb/AppData/Local/R/win-library/4.2
[2] C:/Program Files/R/R-4.2.1/library
D ── DLL MD5 mismatch, broken installation.
I just ran into the same problem, I found a reference for the description and solution of this problem, but I haven't found the answer yet, I hope it will help you, if you find a solution, you can also share it, the original text is as follows:
Bayesian models require the rstan
interface to Stan. Sometimes this is as simple as
installing Rtools and calling the above install.packages
or install_github
command, but other
times everything seems fine until you try to run a Bayesian model in
streamMetabolizer
. Symptoms of an imperfect rstan
installation are probably
diverse. Here's one we've seen:
> bayes_fit <- metab(specs('bayes'), data=mydat)
Warning message:
In metab_fun(specs = specs, data = data, data_daily = data_daily, :
Modeling failed: argument is of length zero
> get_fit(bayes_fit)
...
$warnings
[1] "running command ''/Library/Frameworks/R.framework/Resources/bin/R' CMD config CXX 2>/dev/null' had status 1"
$errors
[1] "argument is of length zero"
In such cases you should refer to the detailed instructions on the rstan
website for
Mac and Linux
or Windows.
Hi ahaha123589413
remove.packages(c("rstan","StanHeaders"))
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")))
This fixed the problem for me.
For more info see:
https://discourse.mc-stan.org/t/error-in-compilecode-invalid-connection/27693/2
Thank you! It is working now.
Thanks, @woodwardb1 and @ahaha123589413 ! I had my email notifications misconfigured and was overwhelmed with unrelated tasks anyway, but I'm glad you were able to figure it out yourselves, hope your notes help others, and intend to be at least a little more on the ball as maintainer going forward.