Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R session crashes on Windows (fatal error), on basic tutorial example #4259

Closed
actuarial-lonewolf opened this issue May 5, 2021 · 4 comments

Comments

@actuarial-lonewolf
Copy link

actuarial-lonewolf commented May 5, 2021

Description

R session has a fatal crash when trying to run lightgbm, on Windows.

I had this behavior earlier this year and noticed it crashed whenever lightgbm was loaded last.
My quick fix back then, was to load lightgbm first, and then everything worked out good.

Interestingly, it was later reported here.

However, I'm opening a bug report this time around, because no matter what I try, lightgbm crashes all the time. My trick no longer works...

Thanks!

Reproducible example

install.packages("lightgbm")
library(lightgbm)

data(agaricus.train, package='lightgbm')
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
model <- lgb.cv(
  params = list(
    objective = "regression"
    , metric = "l2"
  )
  , data = dtrain
)  

Environment info

sessionInfo()

R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252    LC_MONETARY=English_Canada.1252 LC_NUMERIC=C                    LC_TIME=English_Canada.1252    

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

other attached packages:
[1] lightgbm_3.2.1 R6_2.4.1      

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5           lubridate_1.7.9.2    lattice_0.20-41      prettyunits_1.1.1    class_7.3-18         ps_1.5.0             assertthat_0.2.1    
 [8] rprojroot_2.0.2      digest_0.6.25        ipred_0.9-9          foreach_1.5.1        plyr_1.8.6           stats4_4.0.5         ggplot2_3.3.2       
[15] pillar_1.4.6         rlang_0.4.9          caret_6.0-86         rstudioapi_0.13      data.table_1.13.4    callr_3.5.1          rpart_4.1-15        
[22] Matrix_1.3-2         reticulate_1.19      desc_1.2.0           devtools_2.3.2       splines_4.0.5        gower_0.2.2          stringr_1.4.0       
[29] munsell_0.5.0        tinytex_0.28         compiler_4.0.5       xfun_0.19            pkgconfig_2.0.3      pkgbuild_1.2.0       nnet_7.3-15         
[36] tidyselect_1.1.0     tibble_3.0.5         prodlim_2019.11.13   corrr_0.4.3          codetools_0.2-18     fansi_0.4.1          crayon_1.3.4        
[43] dplyr_1.0.2          withr_2.3.0          MASS_7.3-53.1        recipes_0.1.15       ModelMetrics_1.2.2.2 grid_4.0.5           jsonlite_1.7.2      
[50] nlme_3.1-152         gtable_0.3.0         lifecycle_0.2.0      magrittr_2.0.1       pROC_1.16.2          scales_1.1.1         cli_2.2.0           
[57] stringi_1.5.3        reshape2_1.4.4       fs_1.5.0             remotes_2.2.0        testthat_3.0.1       timeDate_3043.102    ellipsis_0.3.1      
[64] generics_0.1.0       vctrs_0.3.4          lava_1.6.8.1         iterators_1.0.13     tools_4.0.5          glue_1.4.2           purrr_0.3.4         
[71] processx_3.4.5       pkgload_1.1.0        survival_3.2-10      yaml_2.2.1           colorspace_2.0-0     sessioninfo_1.1.1    memoise_1.1.0       
[78] usethis_2.0.0  

Using RStudio version 1.3.1093

EDIT: Updated R6 package to 2.5.0 to see if it would fix things.
Unfortunately, same behavior.

@jameslamb
Copy link
Collaborator

Hi @actuariallonewolf , thanks for using LightGBM and for the report.

I noticed in your example that you are on Windows and that you're installing {lightgbm} 3.2.1 from CRAN. I expect that your problem is similar to others that were reported in the last few months:

Those have been fixed in this repository but a new release has not yet been published to CRAN with those changes.

Can you please try installing {lightgbm} from source and let me know if that fixes the problem for you?

git clone --recursive https://github.com/microsoft/LightGBM.git
cd LightGBM
sh build-cran-package.sh
R CMD INSTALL lightgbm_3.2.1.99.tar.gz

@actuarial-lonewolf
Copy link
Author

actuarial-lonewolf commented May 5, 2021

Hi,

I'm working from a heavily restricted environment. At this point, I'm not sure I can install like you propose.

However, I noticed in the other thread, you suggested to try through R.

R --vanilla --no-restore

To my surprised, it worked.

I went back to RStudio, and selected Session >> Clear Workspace >> Yes.
It now works. I'm puzzled.

sessionInfo()

R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252    LC_MONETARY=English_Canada.1252 LC_NUMERIC=C                    LC_TIME=English_Canada.1252    

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

other attached packages:
[1] lightgbm_3.2.1 R6_2.5.0      

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5        pillar_1.4.6      compiler_4.0.5    prettyunits_1.1.1 remotes_2.2.0     tools_4.0.5       testthat_3.0.1    digest_0.6.25    
 [9] pkgbuild_1.2.0    pkgload_1.1.0     tibble_3.0.5      gtable_0.3.0      jsonlite_1.7.2    memoise_1.1.0     lifecycle_0.2.0   lattice_0.20-41  
[17] pkgconfig_2.0.3   rlang_0.4.9       Matrix_1.3-2      cli_2.2.0         rstudioapi_0.13   yaml_2.2.1        xfun_0.19         dplyr_1.0.2      
[25] corrr_0.4.3       withr_2.3.0       generics_0.1.0    vctrs_0.3.4       desc_1.2.0        fs_1.5.0          devtools_2.3.2    tidyselect_1.1.0 
[33] rprojroot_2.0.2   grid_4.0.5        reticulate_1.19   glue_1.4.2        data.table_1.13.4 processx_3.4.5    fansi_0.4.1       sessioninfo_1.1.1
[41] ggplot2_3.3.2     callr_3.5.1       purrr_0.3.4       magrittr_2.0.1    scales_1.1.1      ps_1.5.0          ellipsis_0.3.1    usethis_2.0.0    
[49] assertthat_0.2.1  colorspace_2.0-0  tinytex_0.28      munsell_0.5.0     crayon_1.3.4 

Thanks for your quick response.

No longer a blocker since I don't mind loading lightgbm first.
Case closed.

@jameslamb
Copy link
Collaborator

I went back to RStudio, and selected Session >> Clear Workspace >> Yes.
It now works. I'm puzzled.

Oh! Ok, maybe you have this issue: #4208. That is being actively worked on and will be fixed in the next release.

For now, as a general rule you should not attempt to save {lightgbm} Booster, Dataset, or Predictor objects in a .Rdata or .rda file and try to load them in a new session.

I'm working from a heavily restricted environment. At this point, I'm not sure I can install like you propose.

Sure, no problem.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants