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

After update to R 4.0.0: multi-core doesn't work #113

Open
agilebean opened this issue May 23, 2020 · 7 comments
Open

After update to R 4.0.0: multi-core doesn't work #113

agilebean opened this issue May 23, 2020 · 7 comments

Comments

@agilebean
Copy link

@agilebean agilebean commented May 23, 2020

After update from R 3.6 to 4.0 on MacOS Catalina,
plot_gg() does not work in multi-core mode, and the ETA visualization bar is not shown either.
After about 1.5 min, the following error is thrown:

Error in makePSOCKcluster(names = spec, ...) : 
  Cluster setup failed. 16 of 16 workers failed to connect.

Is this due to an underlying library?
Reinstalling Rccp package did not help.

sessionInfo:

R version 4.0.0 (2020-04-24)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.4

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/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] rayshader_0.16.0         DataExplorer_0.8.1       rmarkdown_2.1           
 [4] likert_1.3.5             xtable_1.8-4             machinelearningtools_0.1
 [7] forcats_0.5.0            stringr_1.4.0            dplyr_0.8.99.9003       
[10] purrr_0.3.4              readr_1.3.1              tidyr_1.1.0             
[13] tibble_3.0.1             ggplot2_3.3.0            tidyverse_1.3.0         
[16] magrittr_1.5             googlesheets_0.3.0       psych_1.9.12.31         

loaded via a namespace (and not attached):
 [1] nlme_3.1-147            fs_1.4.1                usethis_1.6.1           lubridate_1.7.8        
 [5] devtools_2.3.0          webshot_0.5.2           progress_1.2.2          doParallel_1.0.15      
 [9] RColorBrewer_1.1-2      httr_1.4.1              rprojroot_1.3-2         tools_4.0.0            
[13] backports_1.1.7         utf8_1.1.4              R6_2.4.1                DBI_1.1.0              
[17] colorspace_1.4-1        manipulateWidget_0.10.1 withr_2.2.0             tidyselect_1.1.0       
[21] gridExtra_2.3           prettyunits_1.1.1       mnormt_1.5-7            processx_3.4.2         
[25] compiler_4.0.0          cli_2.0.2               rvest_0.3.5             xml2_1.3.2             
[29] desc_1.2.0              labeling_0.3            scales_1.1.1            callr_3.4.3            
[33] digest_0.6.25           pkgconfig_2.0.3         htmltools_0.4.0         sessioninfo_1.1.1      
[37] fastmap_1.0.1           dbplyr_1.4.3            htmlwidgets_1.5.1       rlang_0.4.6            
[41] readxl_1.3.1            rstudioapi_0.11         shiny_1.4.0.2           farver_2.0.3           
[45] generics_0.0.2          jsonlite_1.6.1          crosstalk_1.1.0.1       Rcpp_1.0.4.6           
[49] munsell_0.5.0           fansi_0.4.1             lifecycle_0.2.0         stringi_1.4.6          
[53] pkgbuild_1.0.8          plyr_1.8.6              grid_4.0.0              promises_1.1.0         
[57] parallel_4.0.0          crayon_1.3.4            miniUI_0.1.1.1          lattice_0.20-41        
[61] haven_2.2.0             hms_0.5.3               knitr_1.28              ps_1.3.3               
[65] pillar_1.4.4            igraph_1.2.5            codetools_0.2-16        reshape2_1.4.4         
[69] pkgload_1.0.2           reprex_0.3.0            glue_1.4.1              packrat_0.5.0          
[73] evaluate_0.14           data.table_1.12.8       remotes_2.1.1           modelr_0.1.8           
[77] httpuv_1.5.2            foreach_1.5.0           vctrs_0.3.0             testthat_2.3.2         
[81] networkD3_0.4           cellranger_1.1.0        gtable_0.3.0            assertthat_0.2.1       
[85] xfun_0.14               mime_0.9                broom_0.5.6             later_1.0.0            
[89] iterators_1.0.12        tinytex_0.23            memoise_1.1.0           rgl_0.100.54           
[93] ellipsis_0.3.1  
@tylermorganwall
Copy link
Owner

@tylermorganwall tylermorganwall commented Jun 10, 2020

Have you tried setting plot_gg(..., raytrace=FALSE)?

@agilebean
Copy link
Author

@agilebean agilebean commented Jun 10, 2020

@tylermorganwall yes, but it doesn't render anything.
This issue seems to be caused by the parallel package that does not work yet with R 4.0.0.
The workaround is to set a sequential option, and because rayshader seems to trigger the makePSOCKcluster(), make an entry in the .Rprofile.

@agilebean
Copy link
Author

@agilebean agilebean commented Jun 10, 2020

R 4.0.0 seems to cause multiple incompatibilities.
The following all worked perfectly under R 3.5.
After getting rid of the makePSOCKcluster error, the plot_gg is able to work on the cluster and finishes. However, the plot is not shown in the Viewer window.
render_snapshot creates a black image, see:
image

@agilebean
Copy link
Author

@agilebean agilebean commented Jun 10, 2020

Removing the multicore option,

gg <- plot_gg(
  ggdiamonds,
  # multicore = TRUE,
  width = 5,
  height = 5,
  scale = 250,
  windowsize = c(1400, 866),
  zoom = 0.55,
  phi = 30
)

triggers ETA progress bar:

image

but still no output shown.
Maybe this a hidden incompatibility between R 4.0.0 and X11??

@tylermorganwall
Copy link
Owner

@tylermorganwall tylermorganwall commented Jun 12, 2020

For the black square, check out this (#77 ) closed issue and make sure you aren't writing to the NULL device in RGL.

e.g. run this before loading either rayshader or rgl

options(rgl.useNULL = FALSE)
@agilebean
Copy link
Author

@agilebean agilebean commented Jun 12, 2020

with

options(rgl.useNULL = FALSE)
render_snapshot()

still a black square is shown in the viewer.

it is too sad that the R4.0 update brought all this!

@tylermorganwall
Copy link
Owner

@tylermorganwall tylermorganwall commented Jun 12, 2020

Are you running that code prior to loading rayshader or rgl with library? With a fresh session:

options(rgl.useNULL = FALSE)
library(rayshader)
...
your code
...

Otherwise it won't have any effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.