How to prevent tidyverse development packages from installing the same dependencies again and again?

Hi everyone,

I'm using several development packages on GitHub (e.g. vqv/ggbiplot, jiho/autoplot, thomasp85/patchwork, r-spatial/sf, etc.) which have tidyverse/ggplot2 package as dependencies. Every time I run devtools::update_packages() (or devtools::install_github("xxx")), each of these packages will try to install tidyverse dev packages. Then R would enter an endless circle like this:

  • install crayon
  • install glue
  • install withr
  • install ansistrings
  • install hms
  • install progress
  • install cli
  • install tibble
  • install purrr
  • install rlang
  • install tidyselect
  • install bindr
  • install bindrcpp
  • install dplyr
  • install stringr
  • install tidyr
  • install broom
  • install lazyeval
  • install scales
  • install ggplot2
  • rinse and repeat

Sometimes it took more than 10 hours to finish the update as R kept re-compiling already installed packages again and again

Is there any way to avoid this that I'm not aware of?

Thank you!

Session info -------------------------------------------------------------------------------
 version  R version 3.4.4 (2018-03-15)
 system   x86_64, mingw32             
 ui       RStudio (1.1.442)  
Packages -----------------------------------------------------------------------------------
 package     * version     date       source                               
 ansistrings   1.0.0.9000  2018-04-04 Github (r-lib/ansistrings@4e4d309)   
 assertthat    0.2.0       2017-04-11 CRAN (R 3.4.4)                       
 autoplot    * 0.1         2018-04-04 Github (jiho/autoplot@142183b)       
 base        * 3.4.4       2018-03-15 local                                
 bindr         0.1.1.9000  2018-04-04 Github (krlmlr/bindr@b6e6fd6)        
 bindrcpp      0.2.2.9000  2018-04-04 Github (krlmlr/bindrcpp@bd5ae73)     
 broom       * 0.4.4       2018-04-04 Github (tidyverse/broom@570b25a)     
 cellranger    1.1.0       2016-07-27 CRAN (R 3.4.4)                       
 class         7.3-14      2015-08-30 CRAN (R 3.4.4)                       
 classInt      0.1-24      2017-04-16 CRAN (R 3.4.2)                       
 cli           1.0.0.9002  2018-04-04 Github (r-pkgs/boxes@c408924)        
 colorspace    1.3-2       2016-12-14 CRAN (R 3.4.4)                       
 compiler      3.4.4       2018-03-15 local                                
 crayon        1.3.4       2018-04-04 Github (gaborcsardi/crayon@95b3eae)  
 curl          3.2         2018-03-28 CRAN (R 3.4.4)                       
 datasets    * 3.4.4       2018-03-15 local                                
 DBI           0.8         2018-03-02 CRAN (R 3.4.3)                       
 devtools    * 1.13.5      2018-02-18 CRAN (R 3.4.3)                       
 digest        0.6.15      2018-01-28 CRAN (R 3.4.3)                       
 dplyr       * 0.7.4.9003  2018-04-04 Github (tidyverse/dplyr@887c239)     
 e1071         1.6-8       2017-02-02 CRAN (R 3.4.3)                       
 forcats     * 0.3.0.9000  2018-03-31 Github (tidyverse/forcats@f4a7fd1)   
 foreign       0.8-69      2017-06-22 CRAN (R 3.4.4)                       
 fortunes      1.5-4       2016-12-29 CRAN (R 3.4.1)                       
 ggbiplot    * 0.55        2018-04-04 Github (vqv/ggbiplot@7325e88)        
 ggplot2     * 2.2.1.9000  2018-04-04 Github (tidyverse/ggplot2@3c9c504)   
 git2r         0.21.0.9002 2018-03-31 Github (ropensci/git2r@198b4d6)      
 glue          1.2.0.9000  2018-04-04 Github (tidyverse/glue@0699687)      
 graphics    * 3.4.4       2018-03-15 local                                
 grDevices   * 3.4.4       2018-03-15 local                                
 grid        * 3.4.4       2018-03-15 local                                
 gtable        0.2.0       2016-02-26 CRAN (R 3.4.4)                       
 haven         1.1.1       2018-01-18 CRAN (R 3.4.4)                       
 hms           0.4.2       2018-04-04 Github (tidyverse/hms@c0cfc01)       
 httr          1.3.1       2017-08-20 CRAN (R 3.4.4)                       
 jsonlite      1.5         2017-06-01 CRAN (R 3.4.4)      
 lattice       0.20-35     2017-03-25 CRAN (R 3.4.4)                       
 lazyeval      0.2.1.9000  2018-04-04 Github (hadley/lazyeval@93c455c)     
 lubridate     1.7.3       2018-03-31 Github (tidyverse/lubridate@9797d69) 
 magrittr      1.5         2014-11-22 CRAN (R 3.4.3)                       
 memoise       1.1.0       2017-04-21 CRAN (R 3.4.4)                       
 methods     * 3.4.4       2018-03-15 local                                
 mnormt        1.5-5       2016-10-15 CRAN (R 3.4.1)                       
 modelr        0.1.1       2017-07-24 CRAN (R 3.4.4)                       
 munsell       0.4.3       2016-02-13 CRAN (R 3.4.3)                       
 nlme          3.1-131.1   2018-02-16 CRAN (R 3.4.4)                       
 pacman        0.4.6       2017-05-14 CRAN (R 3.4.4)                       
 parallel      3.4.4       2018-03-15 local                                
 patchwork   * 0.0.1       2018-03-27 Github (thomasp85/patchwork@49e6ba4) 
 pillar        1.2.1       2018-02-27 CRAN (R 3.4.3)                       
 pkgconfig     2.0.1       2017-03-21 CRAN (R 3.4.4)                       
 plyr        * 1.8.4       2016-06-08 CRAN (R 3.4.4)                       
 prettyunits   1.0.2       2015-07-13 CRAN (R 3.4.3)                       
 progress      1.1.2.9003  2018-04-04 Github (r-lib/progress@e525de4)      
 psych         1.8.3.3     2018-03-30 CRAN (R 3.4.4)                       
 purrr       * 0.2.4.9000  2018-04-04 Github (tidyverse/purrr@84ce1ad)     
 R6            2.2.2       2017-06-17 CRAN (R 3.4.4)                       
 Rcpp          0.12.16     2018-03-13 CRAN (R 3.4.4)                       
 readr       * 1.2.0       2018-03-31 Github (tidyverse/readr@23eb46d)     
 readxl        1.0.0.9000  2018-03-31 Github (tidyverse/readxl@eeeebf8)    
 reshape2      1.4.3       2017-12-11 CRAN (R 3.4.3)                       
 rlang         0.2.0.9001  2018-04-04 Github (r-lib/rlang@49d7a34)         
 rstudioapi    0.7         2017-09-07 CRAN (R 3.4.4)                       
 rvest         0.3.2       2016-06-17 CRAN (R 3.4.3)                       
 scales      * 0.5.0.9000  2018-04-04 Github (hadley/scales@d767915)       
 selectr       0.4-0       2018-03-27 CRAN (R 3.4.4)                       
 sf          * 0.6-2       2018-03-31 Github (r-spatial/sf@08248e6)        
 stats       * 3.4.4       2018-03-15 local                                
 stringi       1.1.7       2018-03-12 CRAN (R 3.4.3)                       
 stringr     * 1.3.0.9000  2018-04-04 Github (tidyverse/stringr@097c0c0)   
 tibble      * 1.4.2.9000  2018-04-04 Github (tidyverse/tibble@7fbef0b)    
 tidyr       * 0.8.0.9000  2018-04-04 Github (tidyverse/tidyr@32b73ea)     
 tidyselect    0.2.4.9000  2018-04-04 Github (tidyverse/tidyselect@72bedbb)
 tidyverse   * 1.2.1       2018-03-31 Github (tidyverse/tidyverse@03ccf9c) 
 tools         3.4.4       2018-03-15 local                                
 udunits2      0.13        2016-11-17 CRAN (R 3.4.1)                       
 units         0.5-1       2018-01-08 CRAN (R 3.4.3)                       
 utils       * 3.4.4       2018-03-15 local                                
 withr         2.1.2       2018-04-04 Github (r-lib/withr@79d7b0d)         
 xml2          1.2.0       2018-01-24 CRAN (R 3.4.3)                       
 yaml          2.1.18      2018-03-08 CRAN (R 3.4.4)
3 Likes

You can exert some control over the behavior with the dependencies argument. By setting dependencies = FALSE, only the packages given to the pkg argument will be updated.

See ?devtools::update_packages for details. This argument also exists in the devtools::install_github function.

4 Likes

Likely the argument you want is devtools::install_github("xyz", upgrade_dependencies = FALSE). By default devtools upgrades all dependencies to the latest versions, this setting will disable this behavior.

The dependencies argument controls what dependencies are installed for packages. If you are sure all dependencies are already installed setting it to FALSE as suggested by @nutterb will only install the package itself.

8 Likes

Thank you guys! I'm not sure if this solves the problem because when updating packages, I still want everything to be checked/updated if needed but only for the 1st time. If I use upgrade_dependencies = FALSE, the dependencies will never get updated, no?

You unfortunately haven't given us enough information to tell why you are getting a cycle, but devtools should be detecting this and only install the packages once. If you are able to provide a reproducible example of the issue there is a better chance of being able to help.

1 Like

If you can make a library similar to this

 ansistrings   1.0.0.9000  2018-04-04 Github (r-lib/ansistrings@4e4d309)   
 bindr         0.1.1.9000  2018-04-04 Github (krlmlr/bindr@b6e6fd6)        
 bindrcpp      0.2.2.9000  2018-04-04 Github (krlmlr/bindrcpp@bd5ae73)     
 broom       * 0.4.4       2018-04-04 Github (tidyverse/broom@570b25a)     
 cli           1.0.0.9002  2018-04-04 Github (r-pkgs/boxes@c408924)        
 crayon        1.3.4       2018-04-04 Github (gaborcsardi/crayon@95b3eae)  
 dplyr       * 0.7.4.9003  2018-04-04 Github (tidyverse/dplyr@887c239)     
 forcats     * 0.3.0.9000  2018-03-31 Github (tidyverse/forcats@f4a7fd1)   
 ggplot2     * 2.2.1.9000  2018-04-04 Github (tidyverse/ggplot2@3c9c504)   
 git2r         0.21.0.9002 2018-03-31 Github (ropensci/git2r@198b4d6)      
 glue          1.2.0.9000  2018-04-04 Github (tidyverse/glue@0699687)      
 hms           0.4.2       2018-04-04 Github (tidyverse/hms@c0cfc01)       
 lazyeval      0.2.1.9000  2018-04-04 Github (hadley/lazyeval@93c455c)     
 lubridate     1.7.3       2018-03-31 Github (tidyverse/lubridate@9797d69) 
 progress      1.1.2.9003  2018-04-04 Github (r-lib/progress@e525de4)      
 purrr       * 0.2.4.9000  2018-04-04 Github (tidyverse/purrr@84ce1ad)     
 readr       * 1.2.0       2018-03-31 Github (tidyverse/readr@23eb46d)     
 readxl        1.0.0.9000  2018-03-31 Github (tidyverse/readxl@eeeebf8)    
 rlang         0.2.0.9001  2018-04-04 Github (r-lib/rlang@49d7a34)         
 scales      * 0.5.0.9000  2018-04-04 Github (hadley/scales@d767915)       
 stringr     * 1.3.0.9000  2018-04-04 Github (tidyverse/stringr@097c0c0)   
 tibble      * 1.4.2.9000  2018-04-04 Github (tidyverse/tibble@7fbef0b)    
 tidyr       * 0.8.0.9000  2018-04-04 Github (tidyverse/tidyr@32b73ea)     
 tidyselect    0.2.4.9000  2018-04-04 Github (tidyverse/tidyselect@72bedbb)
 tidyverse   * 1.2.1       2018-03-31 Github (tidyverse/tidyverse@03ccf9c) 
 withr         2.1.2       2018-04-04 Github (r-lib/withr@79d7b0d)         

Then start installing the following packages one by one

devtools::install_github("jiho/autoplot")
devtools::install_github("vqv/ggbiplot")
devtools::install_github("r-spatial/sf")

Or maybe better installing the 2nd to last commit then run devtools::update_packages()

Thank you!

I have seen this issue before, namely, if I run devtools::update_packages(), I will see the same package getting installed multiple times throughout the process. The impression I got was that package A, B, C all transitively triggers an update on package X. The odd thing is that I have also seen cases that package Y was attempted for installation but correctly skipped because it is up to date.

Unfortunately, I cannot come up with a reprex at the moment. It is just something I see from time to time. I will save a full log next time I see it.

Here is a log that shows rlang was repeatedly installed for 9 times and also skipped as intended for 7 times during a single devtools::update_packages run.

1 Like

I couldn't fix this so I create a new folder and installed packages to that new location. No problem of reinstalling packages over and over again anymore