the-Hull / datacleanr

Interactive and Reproducible Data Cleaning
https://the-hull.github.io/datacleanr
GNU General Public License v3.0
19 stars 5 forks source link

datacleanr starts and errors #8

Closed bpbond closed 3 years ago

bpbond commented 3 years ago

Following the datacleanr README.md instructions:

> dcr_app(iris)

Listening on http://127.0.0.1:7726
Warning: Error in validateNoWS: Invalid .noWS option(s) 'inside' specified.
  58: stop
  57: validateNoWS
  56: shiny::p
  53: datacleanr_server
  52: server
Error in validateNoWS(.noWS) : 
  Invalid .noWS option(s) 'inside' specified.

...with the app displayed in a greyed-out browser window, and nothing responsive. Any advice? This occurs with both the CRAN and GitHub versions. My machine is running R version 3.6.1 (2019-07-05) on MacOS 10.14.6.

the-Hull commented 3 years ago

Thanks for reporting the error. I will dig into it - this is the second report of an issue on MacOS and an older R version, which I am not currently testing for in CI. I'll see if I can get a docker container running with older R versions to reproduce the issue!

Could you try the following and report back, please?

datacleanr::dcr_app(iris, browser = FALSE)

Update: I adjusted the .noWS option from "inside" to c("before", "after"), which may have been causing the issue. It doesn't cause an error on the versions of R I've tested on Ubuntu, so quite surprised but glad you highlighted it. Please reinstall from GitHub with remotes::install_github("the-hull/datacleanr") and let me know if this fixed the issue.

Cheers

bpbond commented 3 years ago

Thanks. Hmm. Updating to the latest datacleanr didn't change anything, but then I updated all the dependencies to their latest versions, and...it seemed to work, until I clicked the 'Start' button, whereupon the screen greyed out again.

...on other pages, the buttons aren't responding.

I don't mind updating to R 4.x, it's time, but the package DESCRIPTION should probably require version 4?

the-Hull commented 3 years ago

Hm, that's unfortunate! No other error messages? The buttons on other pages should only respond after clicking 'Start', so that is expected behavior. The graying-out of course isn't.

We have tested with >= R. 3.6.3, and I just checked it on Ubuntu with R 3.5.3, without issues. Therefore, package dependencies are the most likely issue. I'll add a Depends: R >= 3.6 for now (4 should not be required), as well as explicit specs for the packages used for rendering the app. Please run remotes::install_github("the-hull/datacleanr", force = TRUE) - I hope that will fix it.

If the above did not resolve the issue, further hints could be provided by your browser's console. In that case, could you please access its logs by right-clicking in the browser window opened by dcr_app, and hitting the "Inspect Element" option. You should be able to navigate to a console, where you should see a bunch of warnings and errors related to start-up (i.e. handlers looking for values that are still loading) I commonly see for shiny apps. A right click on these warnings should give the option to export them to the clipboard or a txt file. I'd very much appreciate if you could share the output with me, to further investigate the issue.

Thanks again!

bpbond commented 3 years ago

That didn't resolve the issue. Here's what I'm seeing in the Inspect Element console: Screen Shot 2020-12-16 at 4 30 19 PM

the-Hull commented 3 years ago

Thanks @bpbond, appreciate your time. A google search showed it may be related to how JavaScript resources are read and initialized differently between browsers, and perhaps even affected by plugins. I'll look into the JavaScript code I used to adapt the handling to wait until the app has initialized as son as I can.

Have you tried running dcr_app(iris, browser = FALSE)? Also, would be interesting to know if the app runs without any issues in a different browser, given that Safari, as well as Firefox with certain Add-Ins, was mentioned as producing similar errors as in your screenshot.

bpbond commented 3 years ago

When I do dcr_app(iris, browser = FALSE) it renders in a RStudio popup window and behaves normally until I click Start, whereupon it vanishes and I'm left with

Listening on http://127.0.0.1:6190
  91: stop
  90: runHook
  89: loadNamespace
  86: loadNamespace
  85: getNamespace
  84: asNamespace
  83: getExportedValue
  82: ::
  81: module
  76: shiny::callModule
  75: observeEventHandler
   4: shiny::runApp
   1: dcr_app

Running in Chrome produces the same result as Safari: clicking Start grays out the browser screen. 🤷‍♂️

Thanks!

the-Hull commented 3 years ago

Happy new year, @bpbond !

Sorry for the delay - family time was important this year.

I've updated the minimum versions on most dependencies (non-base R), and hope that may fix the issue, so please try to reinstall from GitHub once more.

Should that not resolve the issue, another point of attack may be checking if summarytools::dfSummary() is the culprit, which fires when clicking Start!. Here, I suspect a potential issue with graphics devices and file system writing permissions. To test that, please run:

 summarytools::view(summarytools::dfSummary(iris))

Thanks again, very much appreciate your help.

bpbond commented 3 years ago

Likewise @the-Hull 🎉

After re-installation from GitHub:

> datacleanr::dcr_app(iris, browser = FALSE)
Loading required package: shiny

Listening on http://127.0.0.1:7869
Registered S3 method overwritten by 'pryr':
  method      from
  print.bytes Rcpp
  91: stop
  90: runHook
  89: loadNamespace
  86: loadNamespace
  85: getNamespace
  84: asNamespace
  83: getExportedValue
  82: ::
  81: module
  76: shiny::callModule
  75: observeEventHandler
   4: shiny::runApp
   1: datacleanr::dcr_app

> summarytools::view(summarytools::dfSummary(iris))
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
  call: fun(libname, pkgname)
  error: X11 library is missing: install XQuartz from xquartz.macosforge.org

FYI

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] shiny_1.5.0

loaded via a namespace (and not attached):
 [1] httr_1.4.2            shinyFiles_0.9.0      tidyr_1.1.2           jsonlite_1.7.2       
 [5] viridisLite_0.3.0     assertthat_0.2.1      pander_0.6.3          yaml_2.2.1           
 [9] remotes_2.1.0         datacleanr_1.0.0.9000 pillar_1.4.7          backports_1.2.1      
[13] glue_1.4.2            digest_0.6.27         promises_1.1.1        pryr_0.1.4           
[17] checkmate_2.0.0       colorspace_2.0-0      htmltools_0.5.0       httpuv_1.5.4         
[21] plyr_1.8.6            clipr_0.7.1           pkgconfig_2.0.3       magick_2.5.2         
[25] purrr_0.3.4           xtable_1.8-4          scales_1.1.1          processx_3.4.5       
[29] whisker_0.4           later_1.1.0.1         tibble_3.0.4          generics_0.1.0       
[33] ggplot2_3.3.3         ellipsis_0.3.1        DT_0.16               withr_2.3.0          
[37] lazyeval_0.2.2        cli_2.2.0             magrittr_2.0.1        crayon_1.3.4         
[41] mime_0.9              evaluate_0.14         ps_1.5.0              fs_1.5.0             
[45] fansi_0.4.1           pkgbuild_1.2.0        rapportools_1.0       rsconnect_0.8.16     
[49] tools_3.6.1           data.table_1.13.6     prettyunits_1.1.1     lifecycle_0.2.0      
[53] matrixStats_0.57.0    stringr_1.4.0         plotly_4.9.2.2        munsell_0.5.0        
[57] reprex_0.3.0          callr_3.5.1           packrat_0.5.0         compiler_3.6.1       
[61] rlang_0.4.10          grid_3.6.1            rstudioapi_0.13       htmlwidgets_1.5.3    
[65] crosstalk_1.1.0.1     rmarkdown_2.5         base64enc_0.1-3       gtable_0.3.0         
[69] codetools_0.2-16      curl_4.3              R6_2.5.0              lubridate_1.7.9.2    
[73] knitr_1.30            dplyr_1.0.2           fastmap_1.0.1         rprojroot_2.0.2      
[77] stringi_1.5.3         Rcpp_1.0.5            vctrs_0.3.6           xfun_0.19            
[81] tidyselect_1.1.0    
the-Hull commented 3 years ago

Thanks once more for helping diagnose the issue.

This issue with summarytools has been reported here (still open), and as the error suggests, relates to the availability of X11 on (the new?) MacOS version.

According to this stackoverflow Q&A:

The OS update deleted the /usr/X11 and /usr/X11R6 symlinks. I had to just re-install XQuartz from macosforge which will setup the symlinks again.

and

R opens graphics windows using the standard X11 library on Macs, which is no longer part of the standard MacOS. When you try running programs that open a graphics window, you will get a message: "Error in check_for_XQuartz(): X11 library is missing: install XQuartz from xquartz.macosforge.org" and it should work.


Edit: From [https://cran.r-project.org/bin/macosx/]():

Note: the use of X11 (including tcltk) requires XQuartz to be installed since it is no longer part of OS X. Always re-install XQuartz when upgrading your macOS to a new major version.


Running capabilities() should confirm if X11 is indeed missing.

Installing X11 as suggested in the error message, or as on the stackoverflow Q&A using homebrew:

brew cask install xquartz

may then fix the issue (but note, I am not a Mac user).

I'll have to consider how to best handle this- possibly check for the capabilities(), as well as sysname, and release in Sys.info(), and fail early with an informative message.

In general, this is an interesting and challenging experience trying to ensure cross-platform compatibility. We had extensively tested on multiple Windows 10 and Ubuntu 19 machines - but only one laptop running MacOS (which likely had an earlier version?).

And once more - thanks for taking your time to help diagnose the issue(s)!

the-Hull commented 3 years ago

I could confirm that installing XQuartz on the latest macOS fixed the Start + Crash issue.

I've changed the function initializing the summarytools::dfSummary() table, from view() to print(), which may make installing XQuartz (for datacleanr) unneccessary. The patched version is now on GitHub (1.0.1). Until I can confirm that installing XQuartz is no longer necessary, I will leave this issue open - in which case I will implement checks and a warning/error as stated above.

the-Hull commented 3 years ago

This should be fixed in https://github.com/the-Hull/datacleanr/commit/6486a17cddceddcd6cf04dd634469b83af1ff7e7 Closing for now. Thanks @bpbond for your help (and in particular MS review)