Error in { : task 3 failed - “RcallMethod: attempt

2019-08-23 08:00发布

问题:

Any help of this would be greatly appreciated.

I have the following R code (following tutorial at https://www.r-bloggers.com/parallel-r-loops-for-windows-and-linux/) to carry out 233 mutually exclusive calculations in parallel. There are 4 cores and 32 GB of RAM on the machine where this code is executing.

# Calculate the number of cores
    no_cores <- detectCores() - 1
    # initiate cluster
    cl <- makeCluster(no_cores)
    registerDoSNOW(cl)

    # Process sandboxes in parallel - there are 233 sandboxes in total
    foreach (j=1:nrow(sandboxes), .packages=c("dplyr", "rJava", "RJDBC", "lazyeval", "caTools", "stringr", "readxl")) %dopar%
    {
      print("Execution is in foreach block now")
      // Do stuff
    }
    stopCluster(cl)

I am getting the error message even before the execution starts inside the foreach loop.

Error in { : 
  task 3 failed - "RcallMethod: attempt to call a method of a NULL object."

Here is the output from sessionInfo()

R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
 [1] doSNOW_1.0.14     snow_0.4-2        doParallel_1.0.10 iterators_1.0.8   foreach_1.4.3     readxl_0.1.1      stringr_1.2.0     caTools_1.17.1   
 [9] lazyeval_0.2.0    RJDBC_0.2-5       DBI_0.6-1         rJava_0.9-8       dplyr_0.5.0      

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.10     codetools_0.2-15 assertthat_0.1   bitops_1.0-6     R6_2.2.0         magrittr_1.5     stringi_1.1.3    tools_3.3.3     
 [9] compiler_3.3.3   tibble_1.3.0