'R claims packages that doParallel depends on are not available even though they are installed and can be loaded

I am trying to install the doParallel package on a shared cluster (Platform: x86_64-redhat-linux-gnu) where I do not have root privileges. The cluster is running R version 3.5.0 (I have asked if this can be updated).

I've pasted the output from install.packages("doParallel",dependencies=T) below. R claims that dplyr is required by recipes but could not be found. But I've installed dplyr and can load it without any issues. Another package that doParallel requires is caret, which in turn requires recipes. The installation of caret fails because of the previous failure to install recipes. R also claims that foreach required by doParallel but could not be found, even though I previously installed it and can load it.

I've tried installing these packages separately, but it leads down a rabbit hole of many other dependencies and R complaining that packages are not available. I've tried many of the suggestions on SO for similar problems, including:

  • deleting old R libraries and reinstalling packages
  • manually installing dependent packages (placing the source files where R should be able to find them)
  • shutting down all R processes and restarting
  • many of the solution seems to involve issues with Windows installations and working with RStudio. These are not relevant since this is a linux machine and I am doing everything from the command line.

R gives the following warning message when trying to install doParallel:

Warning: package ‘dplyr’ was built under R version 3.5.3

Perhaps that is the source of the problem. Unfortunately, I do not have control over R updates on the cluster.

Thanks for any suggestions about solutions.

UPDATE: the suggestion by @r2evans to install dplyr from source and then install doParallel worked. I was able to install doParallel and its dependencies successfully and execute the R code.

Adding output requested by @r2evans (thanks for looking into this):

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

loaded via a namespace (and not attached):
[1] compiler_3.5.0
> .libPaths()
[1] "/<path to personal library>" "/usr/lib64/R/library"               
[3] "/usr/share/R/library"  
> install.packages("doParallel",dependencies=T)
Installing package into ‘...’ <path omitted for security reasons>
(as ‘lib’ is unspecified)
also installing the dependencies ‘recipes’, ‘caret’

trying URL 'https://cran.us.r-project.org/src/contrib/recipes_0.1.13.tar.gz'
Content type 'application/octet-stream' length 633375 bytes (618 KB)
==================================================
downloaded 618 KB

trying URL 'https://cran.us.r-project.org/src/contrib/caret_6.0-86.tar.gz'
Content type 'application/octet-stream' length 5264447 bytes (5.0 MB)
==================================================
downloaded 5.0 MB

trying URL 'https://cran.us.r-project.org/src/contrib/doParallel_1.0.15.tar.gz'
Content type 'application/octet-stream' length 173578 bytes (169 KB)
==================================================
downloaded 169 KB

* installing *source* package ‘recipes’ ...
** package ‘recipes’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
Warning: package ‘dplyr’ was built under R version 3.5.3
** help
*** installing help indices
  converting help for package ‘recipes’
    finding HTML links ... done
    add_step                                html  
    bake                                    html  
    finding level-2 HTML links ... done

    check_class                             html  
    check_cols                              html  
    check_missing                           html  
    check_name                              html  
    check_new_values                        html  
    check_range                             html  
    check_type                              html  
    detect_step                             html  
    discretize                              html  
    fixed                                   html  
    format_ch_vec                           html  
    formula.recipe                          html  
    fully_trained                           html  
    has_role                                html  
    juice                                   html  
    names0                                  html  
    prep                                    html  
    prepper                                 html  
    print.recipe                            html  
    rand_id                                 html  
    recipe                                  html  
    recipes-internal                        html  
    recipes                                 html  
    recipes_pkg_check                       html  
    reexports                               html  
    roles                                   html  
    selections                              html  
    step                                    html  
    step_BoxCox                             html  
    step_YeoJohnson                         html  
    step_arrange                            html  
    step_bagimpute                          html  
    step_bin2factor                         html  
    step_bs                                 html  
    step_center                             html  
    step_classdist                          html  
    step_corr                               html  
    step_count                              html  
    step_cut                                html  
    step_date                               html  
    step_depth                              html  
    step_discretize                         html  
    step_downsample                         html  
    step_dummy                              html  
    step_factor2string                      html  
    step_filter                             html  
    step_geodist                            html  
    step_holiday                            html  
    step_hyperbolic                         html  
    step_ica                                html  
    step_integer                            html  
    step_interact                           html  
    step_intercept                          html  
    step_inverse                            html  
    step_invlogit                           html  
    step_isomap                             html  
    step_knnimpute                          html  
    step_kpca                               html  
    step_kpca_poly                          html  
    step_kpca_rbf                           html  
    step_lag                                html  
    step_lincomb                            html  
    step_log                                html  
    step_logit                              html  
    step_lowerimpute                        html  
    step_meanimpute                         html  
    step_medianimpute                       html  
    step_modeimpute                         html  
    step_mutate                             html  
    step_mutate_at                          html  
    step_naomit                             html  
    step_nnmf                               html  
    step_normalize                          html  
    step_novel                              html  
    step_ns                                 html  
    step_num2factor                         html  
    step_nzv                                html  
    step_ordinalscore                       html  
    step_other                              html  
    step_pca                                html  
    step_pls                                html  
    step_poly                               html  
    step_profile                            html  
    step_range                              html  
    step_ratio                              html  
    step_regex                              html  
    step_relevel                            html  
    step_relu                               html  
    step_rename                             html  
    step_rename_at                          html  
    step_rm                                 html  
    step_rollimpute                         html  
    step_sample                             html  
    step_scale                              html  
    step_shuffle                            html  
    step_slice                              html  
    step_spatialsign                        html  
    step_sqrt                               html  
    step_string2factor                      html  
    step_unknown                            html  
    step_unorder                            html  
    step_upsample                           html  
    step_window                             html  
    step_zv                                 html  
    summary.recipe                          html  
    terms_select                            html  
    tidy.recipe                             html  
    tunable.step                            html  
    update.step                             html  
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error : package ‘dplyr’ required by ‘recipes’ could not be found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/rigel/stats/users/gjw10/rpackages2/recipes’
* installing *source* package ‘doParallel’ ...
** package ‘doParallel’ successfully unpacked and MD5 sums checked
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package ‘doParallel’
    finding HTML links ... done
    doParallel-package                      html  
    registerDoParallel                      html  
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error : package ‘foreach’ required by ‘doParallel’ could not be found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘<path to personal library>/doParallel’
ERROR: dependency ‘recipes’ is not available for package ‘caret’
* removing ‘<path to personal library>/caret’

The downloaded source packages are in

    ‘/tmp/Rtmpyd0cpT/downloaded_packages’

Warning messages:
1: In install.packages("doParallel", dependencies = T) :
  installation of package ‘recipes’ had non-zero exit status
2: In install.packages("doParallel", dependencies = T) :
  installation of package ‘doParallel’ had non-zero exit status
3: In install.packages("doParallel", dependencies = T) :
  installation of package ‘caret’ had non-zero exit status


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source