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

Progress bar crashes R in RStudio on MS Windows when using beepr [edited] #133

Open
Hallo951 opened this issue Feb 4, 2022 · 1 comment
Labels
bug Something isn't working gui/RStudio MS Windows

Comments

@Hallo951
Copy link

Hallo951 commented Feb 4, 2022

Hi,

I am trying to create a progessbar for a parallel foreach loop but R-Studio always crashes when I use this package. Without it everything works without errors.

What am I doing wrong?

Here is my code:

library(doRNG)
library(doFuture)
registerDoFuture()      ## %dopar% parallelizes via future
plan(multisession)

library(progressr)
handlers(global = TRUE)
handlers("progress", "beepr")

with_progress({
  p <- progressor(step= length(numVector))
  y <- foreach(x = numVector) %dorng% {
    Sys.sleep(6.0-x)
    p()
    sqrt(x)
  }
})

And here my session:

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

Matrix products: default

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

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

other attached packages:
[1] doSNOW_1.0.19 snow_0.4-4 dplyr_1.0.7 spdep_1.2-1 sf_1.0-5 spData_2.0.1 Boruta_7.0.0
[8] iterators_1.0.13 progress_1.2.2 rrapply_1.2.3 RColorBrewer_1.1-2 terra_1.5-17 gridExtra_2.3 PresenceAbsence_1.1.9
[15] qs_0.25.2 purrr_0.3.4 ggplotify_0.1.0 cowplot_1.1.1 caret_6.0-90 ggplot2_3.3.5 MuMIn_1.43.17
[22] plyr_1.8.6 formula.tools_1.7.1 rlist_0.4.6.2 data.table_1.14.2 eHOF_1.10 lattice_0.20-41 mgcv_1.8-34
[29] nlme_3.1-152 MLmetrics_1.1.1 usdm_1.1-18 raster_3.5-11 sp_1.4-6 psych_2.1.9 openxlsx_4.2.5
[36] stringr_1.4.0 beepr_1.3 progressr_0.10.0 doRNG_1.8.2 rngtools_1.5.2 doFuture_0.12.0 future.apply_1.8.1
[43] future_1.23.0 foreach_1.5.1

loaded via a namespace (and not attached):
[1] utf8_1.2.2 tidyselect_1.1.1 mlr3misc_0.10.0 pROC_1.18.0 munsell_0.5.0 codetools_0.2-18 units_0.7-2
[8] withr_2.4.3 audio_0.1-10 colorspace_2.0-2 knitr_1.37 uuid_1.0-3 rstudioapi_0.13 stats4_4.0.5
[15] mapmisc_1.8.0 wk_0.6.0 ggsignif_0.6.3 tensor_1.5 listenv_0.8.0 mnormt_2.0.2 lgr_0.4.3
[22] polyclip_1.10-0 ENMeval_2.0.3 parallelly_1.30.0 vctrs_0.3.8 generics_0.1.1 ipred_0.9-12 xfun_0.29
[29] R6_2.5.1 lhs_1.1.3 spatstat.utils_2.3-0 gridGraphics_0.5-1 assertthat_0.2.1 scales_1.1.1 nnet_7.3-15
[36] rgeos_0.5-9 gtable_0.3.0 globals_0.14.0 goftest_1.2-3 timeDate_3043.102 rlang_0.4.12 splines_4.0.5
[43] rstatix_0.7.0 rgdal_1.5-28 ModelMetrics_1.2.2.2 paradox_0.7.1 hexbin_1.28.2 spatstat.geom_2.3-1 broom_0.7.11
[50] checkmate_2.0.0 s2_1.0.7 reshape2_1.4.4 abind_1.4-5 mlr3_0.13.1 backports_1.4.1 tools_4.0.5
[57] lava_1.6.10 ellipsis_0.3.2 spatstat.core_2.3-2 proxy_0.4-26 Rcpp_1.0.8 classInt_0.4-3 prettyunits_1.1.1
[64] ggpubr_0.4.0 rpart_4.1-15 deldir_1.0-6 zoo_1.8-9 magrittr_2.0.1 groupdata2_2.0.0 tmvnsim_1.0-2
[71] stringfish_0.15.5 hms_1.1.1 jpeg_0.1-9 compiler_4.0.5 tibble_3.1.6 KernSmooth_2.23-18 crayon_1.4.2
[78] tidyr_1.1.4 RcppParallel_5.1.5 lubridate_1.8.0 DBI_1.1.2 RApiSerialize_0.1.0 MASS_7.3-53.1 boot_1.3-28
[85] SDMtune_1.1.5 Matrix_1.3-2 car_3.0-12 gower_0.2.2 forcats_0.5.1 pkgconfig_2.0.3 spatstat.sparse_2.1-0
[92] recipes_0.1.17 xml2_1.3.3 rmaxent_0.8.5.9000 prodlim_2019.11.13 rvest_1.0.2 yulab.utils_0.0.4 digest_0.6.29
[99] spatstat.data_2.1-2 operator.tools_1.6.3 gtools_3.9.2 lifecycle_1.0.1 dismo_1.3-5 carData_3.0-5 ENMTools_1.0.5
[106] viridisLite_0.4.0 fansi_1.0.2 pillar_1.6.4 spatstat.linnet_2.3-1 httr_1.4.2 survival_3.2-10 glue_1.6.0
[113] remotes_2.4.2 rasterVis_0.51.1 zip_2.2.0 spatstat_2.3-0 png_0.1-7 class_7.3-20 stringi_1.7.6
[120] palmerpenguins_0.1.0 latticeExtra_0.6-29 e1071_1.7-9

@HenrikBengtsson
Copy link
Collaborator

HenrikBengtsson commented Feb 5, 2022

Hi, thanks for reporting.

I am trying to create a progessbar for a parallel foreach loop but R-Studio always crashes when I use this package. Without it everything works without errors.

What am I doing wrong?

Probably nothing.

I've tried your example (using numVector <- 1:6) on R 4.1.2 on Linux and on MS Windows. For both operating system, I tried with R in the terminal as well as R in the RStudio Desktop.

I can confirm that using the 'beepr' handlers causes R to crash when using the RStudio Desktop on MS Windows. It works on Linux, and on MS Windows, it works fine when running R in the terminal and via the RGui interface. This smells like an RStudio Console issue/limitation. I'll investigate (beepr::beep() by itself seems to work just fine, and also when not using futures). If it cannot be fixed, at least progressr should prevent use of the 'beepr' handler in RStudio on MS Windows. Crashing is never acceptable.

Try again without using 'beepr', e.g.

handlers("progress")

or, the default:

handlers("txtprogressbar")

PS. Whenever troubleshooting, make sure to do so in a clean R environment. For example, it could be that one of your 123 loaded packages could cause a conflict here.

@HenrikBengtsson HenrikBengtsson added the bug Something isn't working label Feb 5, 2022
@HenrikBengtsson HenrikBengtsson added this to the Next release milestone Feb 5, 2022
@HenrikBengtsson HenrikBengtsson changed the title Text progressbar for parallel foreach loops in R with OS windows crashed Progress bar crashes R in RStudio on MS Windows when using beepr [edited] Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gui/RStudio MS Windows
Projects
None yet
Development

No branches or pull requests

2 participants