HenrikBengtsson / parallelly

R package: parallelly - Enhancing the 'parallel' Package
https://parallelly.futureverse.org
130 stars 7 forks source link

package fails to load on R 4.2.0 #60

Closed richarddmorey closed 3 years ago

richarddmorey commented 3 years ago

parallelly fails to load on the development version of R. This appears to be due to an undefined variable in parallelly_disable_parallel_setup_if_needed() that has the same name as a base R function (rev).

Steps to reproduce:

  1. Install R-devel (4.2.0)
  2. Attempt to install parallelly with install.packages()
  3. See error:
Retrieving 'https://cloud.r-project.org/src/contrib/parallelly_1.26.1.tar.gz' ...
    OK [file is up to date]
Installing parallelly [1.26.1] ...
    FAILED
Error installing package 'parallelly':
======================================

* installing to library ‘/Users/richard/OneDrive - Cardiff University/Research/alphabetArithmetic/renv/staging/1’
* installing *source* package ‘parallelly’ ...
** package ‘parallelly’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘parallelly’:
 .onLoad failed in loadNamespace() for 'parallelly', details:
  call: is.finite(rev)
  error: default method not implemented for type 'closure'
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/richard/OneDrive - Cardiff University/Research/alphabetArithmetic/renv/staging/1/parallelly’
Error: install of package 'parallelly' failed [error code 1]

My guess is that the error is here (https://github.com/HenrikBengtsson/parallelly/blob/30c8893ae27158a9f7cf99f56a0dac2fa6d1d012/R/parallelly_disable_parallel_setup_if_needed.R#L32):

} else if (rver == "4.2.0") {
    if (R.version[["status"]] != "Under development (unstable)") return()
    if (length(rev) == 1L && is.finite(rev) && rev >= 80472) {
      return()
    }

In contrast to the if (rver == "4.1.0") { block above it, rev is not defined first, meaning rev is just the base R function. This causes the error "error: default method not implemented for type 'closure'" (At least, that's my bet).

My sessionInfo():

R Under development (unstable) (2021-07-06 r80602)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

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

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

other attached packages:
[1] forcats_0.5.1   stringr_1.4.0   dplyr_1.0.7     purrr_0.3.4    
[5] readr_1.4.0     tidyr_1.1.3     tibble_3.1.2    ggplot2_3.3.5  
[9] tidyverse_1.3.1

loaded via a namespace (and not attached):
  [1] nlme_3.1-152         fs_1.5.0             matrixStats_0.59.0  
  [4] xts_0.12.1           lubridate_1.7.10     threejs_0.3.3       
  [7] httr_1.4.2           rprojroot_2.0.2      rstan_2.21.2        
 [10] tools_4.2.0          backports_1.2.1      utf8_1.2.1          
 [13] R6_2.5.0             DT_0.18              mgcv_1.8-36         
 [16] DBI_1.1.1            colorspace_2.0-2     withr_2.4.2         
 [19] tidyselect_1.1.1     gridExtra_2.3        prettyunits_1.1.1   
 [22] processx_3.5.2       curl_4.3.2           compiler_4.2.0      
 [25] rvest_1.0.0          cli_3.0.0            xml2_1.3.2          
 [28] shinyjs_2.0.0        labeling_0.4.2       colourpicker_1.1.0  
 [31] scales_1.1.1         dygraphs_1.1.1.6     ggridges_0.5.3      
 [34] callr_3.7.0          digest_0.6.27        StanHeaders_2.21.0-7
 [37] rmarkdown_2.9        base64enc_0.1-3      pkgconfig_2.0.3     
 [40] htmltools_0.5.1.1    dbplyr_2.1.1         fastmap_1.1.0       
 [43] readxl_1.3.1         htmlwidgets_1.5.3    rlang_0.4.11        
 [46] rstudioapi_0.13      shiny_1.6.0          farver_2.1.0        
 [49] generics_0.1.0       zoo_1.8-9            jsonlite_1.7.2      
 [52] crosstalk_1.1.1      gtools_3.9.2         inline_0.3.19       
 [55] magrittr_2.0.1       loo_2.4.1            bayesplot_1.8.1     
 [58] Matrix_1.3-4         Rcpp_1.0.7           munsell_0.5.0       
 [61] fansi_0.5.0          lifecycle_1.0.0      stringi_1.6.2       
 [64] yaml_2.2.1           pkgbuild_1.2.0       plyr_1.8.6          
 [67] grid_4.2.0           parallel_4.2.0       promises_1.2.0.1    
 [70] crayon_1.4.1         miniUI_0.1.1.1       lattice_0.20-44     
 [73] splines_4.2.0        haven_2.4.1          hms_1.1.0           
 [76] knitr_1.33           ps_1.6.0             pillar_1.6.1        
 [79] igraph_1.2.6         markdown_1.1         shinystan_2.5.0     
 [82] reshape2_1.4.4       codetools_0.2-18     stats4_4.2.0        
 [85] reprex_2.0.0         glue_1.4.2           evaluate_0.14       
 [88] V8_3.4.2             modelr_0.1.8         renv_0.13.2         
 [91] RcppParallel_5.1.4   vctrs_0.3.8          httpuv_1.6.1        
 [94] cellranger_1.1.0     gtable_0.3.0         assertthat_0.2.1    
 [97] xfun_0.24            mime_0.11            xtable_1.8-4        
[100] broom_0.7.8          later_1.2.0          rsconnect_0.8.18    
[103] shinythemes_1.2.0    ellipsis_0.3.2       here_1.0.1