Error: bonsai installation in Windows

Hi guys

I have been trying to load and install the bonsai package to perform regression using the lightgbm engine but I keep encountering the error:
Error: package or namespace load failed for ‘bonsai’:
.onLoad failed in loadNamespace() for 'bonsai', details:
call: is_discordant_info(model, mode, eng, new_fit)
error: The combination of engine 'lightgbm' and mode 'regression' already has fit data for model 'boost_tree' and the new information being registered is different.

I have:
-Downloaded RTools 4.4
-Downloaded RStudio again
-Restarted RStudio, and still no success

Please find below the sessionInfo:

Error: package or namespace load failed for ‘bonsai’:
.onLoad failed in loadNamespace() for 'bonsai', details:
call: is_discordant_info(model, mode, eng, new_fit)
error: The combination of engine 'lightgbm' and mode 'regression' already has fit data for model 'boost_tree' and the new information being registered is different.

sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_South Africa.utf8 LC_CTYPE=English_South Africa.utf8
[3] LC_MONETARY=English_South Africa.utf8 LC_NUMERIC=C
[5] LC_TIME=English_South Africa.utf8

attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base

other attached packages:
[1] doMC_1.3.5 iterators_1.0.14 foreach_1.5.2 probably_1.0.3
[5] reticulate_1.35.0 flextable_0.9.5 glmulti_1.0.8 leaps_3.1
[9] rJava_1.0-11 sjPlot_2.8.15 car_3.1-2 carData_3.0-5
[13] tictoc_1.2.1 janitor_2.2.0 naniar_1.1.0 skimr_2.1.5
[17] corrr_0.4.4 kableExtra_1.4.0 here_1.0.1 finetune_1.1.0
[21] ggpie_0.2.5 lightgbm_4.3.0 treesnip_0.1.0.9001 yardstick_1.3.0
[25] workflowsets_1.0.1 workflows_1.1.4 tune_1.1.2 rsample_1.2.0
[29] recipes_1.0.10 parsnip_1.2.0 modeldata_1.3.0 infer_1.0.6
[33] dials_1.2.1 broom_1.0.5 tidymodels_1.1.1 silgelib_0.1.1
[37] scales_1.3.0 lubridate_1.9.3 forcats_1.0.0 stringr_1.5.1
[41] dplyr_1.1.4 purrr_1.0.2 readr_2.1.5 tidyr_1.3.1
[45] tibble_3.2.1 ggplot2_3.5.0 tidyverse_2.0.0 knitr_1.45

loaded via a namespace (and not attached):
[1] utf8_1.2.4 tidyselect_1.2.1 lme4_1.1-35.1
[4] grid_4.2.2 munsell_0.5.0 codetools_0.2-19
[7] ragg_1.3.0 future_1.33.1 withr_3.0.0
[10] colorspace_2.1-0 uuid_1.2-0 rstudioapi_0.15.0
[13] officer_0.6.5 fontLiberation_0.1.0 listenv_0.9.1
[16] emmeans_1.10.0 repr_1.1.6 DiceDesign_1.10
[19] rprojroot_2.0.4 parallelly_1.37.1 vctrs_0.6.5
[22] generics_0.1.3 TH.data_1.1-2 ipred_0.9-14
[25] xfun_0.42 timechange_0.3.0 fontquiver_0.2.1
[28] R6_2.5.1 lhs_1.1.6 promises_1.2.1
[31] multcomp_1.4-25 nnet_7.3-19 gtable_0.3.4
[34] globals_0.16.3 sandwich_3.1-0 timeDate_4032.109
[37] rlang_1.1.3 systemfonts_1.0.6 splines_4.2.2
[40] abind_1.4-5 modelr_0.1.11 backports_1.4.1
[43] httpuv_1.6.14 tools_4.2.2 lava_1.8.0
[46] ellipsis_0.3.2 RColorBrewer_1.1-3 Rcpp_1.0.12
[49] base64enc_0.1-3 rpart_4.1.23 openssl_2.1.1
[52] zoo_1.8-12 ggrepel_0.9.5 furrr_0.3.1
[55] crul_1.4.0 magrittr_2.0.3 data.table_1.15.2
[58] GPfit_1.0-8 mvtnorm_1.2-4 ggnewscale_0.4.10
[61] sjmisc_2.8.9 hms_1.1.3 mime_0.12
[64] evaluate_0.23 xtable_1.8-4 sjstats_0.18.2
[67] ggeffects_1.5.0 compiler_4.2.2 fontBitstreamVera_0.1.1
[70] crayon_1.5.2 minqa_1.2.6 htmltools_0.5.7
[73] later_1.3.2 tzdb_0.4.0 visdat_0.6.0
[76] sjlabelled_1.2.0 MASS_7.3-60.0.1 boot_1.3-30
[79] Matrix_1.6-5 cli_3.6.2 insight_0.19.9
[82] gower_1.0.1 pkgconfig_2.0.3 xml2_1.3.6
[85] svglite_2.1.3 hardhat_1.3.1 estimability_1.4.1
[88] prodlim_2023.08.28 snakecase_0.11.1 digest_0.6.34
[91] httpcode_0.3.0 rmarkdown_2.26 gdtools_0.3.6
[94] curl_5.2.0 shiny_1.8.0 nloptr_2.0.3
[97] lifecycle_1.0.4 nlme_3.1-164 jsonlite_1.8.8
[100] viridisLite_0.4.2 askpass_1.2.0 fansi_1.0.6
[103] pillar_1.9.0 lattice_0.22-5 fastmap_1.1.1
[106] survival_3.5-8 glue_1.7.0 bayestestR_0.13.2
[109] zip_2.3.1 png_0.1-8 class_7.3-22
[112] stringi_1.8.3 performance_0.10.9 textshaping_0.3.7
[115] gfonts_0.2.0 future.apply_1.11.1

You need to run

install.packages("bonsai")

to install the package. Once installed, you can load it with

library(bonsai)

If the installation fails, then please show is the complete output of install.packages("bonsai").

@Gabor

Please see below the error from the installation:

library(bonsai)
Error: package or namespace load failed for ‘bonsai’:
.onLoad failed in loadNamespace() for 'bonsai', details:
call: is_discordant_info(model, mode, eng, new_fit)
error: The combination of engine 'lightgbm' and mode 'regression' already has fit data for model 'boost_tree' and the new information being registered is different.

This is not an installation, this is loading the package. Can you try to reinstall it with

install.packages("bonsai")

? You might need/want to reinstall lightgbm as well:

install.packages("lightgbm")

In any case, this seems like an error coming from the bonsai package, so if reinstalling it does not work, maybe try reporting an issue to the bonsai maintainers.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.