Skip to content

Please look at this before asking questions.

Package installation

How do I reinstall a package?

pak does not reinstall a package, if the same version is already installed. Sometimes you still want a reinstall, e.g. to fix a broken installation. In this case you can delete the package and then install it, or use the ?reinstall parameter:

pak::pkg_install("tibble")

#>                                                                                 
#> → Will install 13 packages.                                                     
#> → All 13 packages (7.45 MB) are cached.                                         
#> + cli         3.3.0                                                             
#> + crayon      1.5.1                                                             
#> + ellipsis    0.3.2                                                             
#> + fansi       1.0.3                                                             
#> + glue        1.6.2                                                             
#> + lifecycle   1.0.1                                                             
#> + magrittr    2.0.3                                                             
#> + pillar      1.7.0                                                             
#> + pkgconfig   2.0.3                                                             
#> + rlang       1.0.2                                                             
#> + tibble      3.1.7                                                             
#> + utf8        1.2.2                                                             
#> + vctrs       0.4.1                                                             
#>  No downloads are needed, 13 pkgs (7.45 MB) are cached                         
#>  Got ellipsis 0.3.2 (aarch64-apple-darwin20) (38.65 kB)                        
#>  Got lifecycle 1.0.1 (aarch64-apple-darwin20) (107.55 kB)                      
#>  Got crayon 1.5.1 (aarch64-apple-darwin20) (158.62 kB)                         
#>  Got glue 1.6.2 (aarch64-apple-darwin20) (154.64 kB)                           
#>  Got pkgconfig 2.0.3 (aarch64-apple-darwin20) (17.70 kB)                       
#>  Got utf8 1.2.2 (aarch64-apple-darwin20) (209.24 kB)                           
#>  Got magrittr 2.0.3 (aarch64-apple-darwin20) (231.25 kB)                       
#>  Got fansi 1.0.3 (aarch64-apple-darwin20) (379.23 kB)                          
#>  Got cli 3.3.0 (aarch64-apple-darwin20) (1.17 MB)                              
#>  Got pillar 1.7.0 (aarch64-apple-darwin20) (744.33 kB)                         
#>  Got tibble 3.1.7 (aarch64-apple-darwin20) (723.61 kB)                         
#>  Got vctrs 0.4.1 (aarch64-apple-darwin20) (1.76 MB)                            
#>  Got rlang 1.0.2 (aarch64-apple-darwin20) (1.79 MB)                            
#>  Installed cli 3.3.0  (66ms)                                                   
#>  Installed crayon 1.5.1  (75ms)                                                
#>  Installed ellipsis 0.3.2  (85ms)                                              
#>  Installed fansi 1.0.3  (109ms)                                                
#>  Installed glue 1.6.2  (117ms)                                                 
#>  Installed lifecycle 1.0.1  (126ms)                                            
#>  Installed magrittr 2.0.3  (133ms)                                             
#>  Installed pillar 1.7.0  (151ms)                                               
#>  Installed pkgconfig 2.0.3  (36ms)                                             
#>  Installed rlang 1.0.2  (56ms)                                                 
#>  Installed tibble 3.1.7  (40ms)                                                
#>  Installed utf8 1.2.2  (38ms)                                                  
#>  Installed vctrs 0.4.1  (28ms)                                                 
#>  1 pkg + 12 deps: added 13, dld 13 (7.48 MB) [4.7s]                            

pak::pkg_install("tibble?reinstall")

#>                                                                                 
#> → Will install 1 package.                                                       
#> → The package (724.32 kB) is cached.                                            
#> + tibble   3.1.7                                                                
#>  No downloads are needed, 1 pkg (724.32 kB) is cached                          
#>  Installed tibble 3.1.7  (27ms)                                                
#>  1 pkg + 12 deps: kept 11, added 1 [746ms]                                     

How do I install a package from source?

To force the installation of a source package (instead of a binary package), use the ?source parameter:

pak::pkg_install("tibble?source")

#>                                                                                 
#> → Will install 1 package.                                                       
#> → The package (672.34 kB) is cached.                                            
#> + tibble   3.1.7 👷🏼🔧                                                            
#>  No downloads are needed, 1 pkg (672.34 kB) is cached                          
#>  Got tibble 3.1.7 (source) (674.87 kB)                                         
#>  Building tibble 3.1.7                                                         
#>  Built tibble 3.1.7 (2.8s)                                                     
#>  Installed tibble 3.1.7  (26ms)                                                
#>  1 pkg + 12 deps: kept 11, added 1, dld 1 (674.87 kB) [8.2s]                   

How do I ignore an optional dependency?

pak::pkg_install(
  c("tibble", "DiagrammeR=?ignore", "formattable?=ignore"),
  dependencies = TRUE
)

#> ! Unknown package parameter: "" in "formattable?=ignore".                       
#>                                                                                 
#> → Will install 57 packages.                                                     
#> → All 57 packages (60.39 MB) are cached.                                        
#> + askpass       1.1                                                             
#> + base64enc     0.1-3                                                           
#> + brio          1.1.3                                                           
#> + bslib         0.3.1                                                           
#> + cachem        1.0.6                                                           
#> + callr         3.7.0                                                           
#> + commonmark    1.8.0                                                           
#> + covr          3.5.1                                                           
#> + crosstalk     1.2.0                                                           
#> + curl          4.3.2                                                           
#> + desc          1.4.1                                                           
#> + diffobj       0.3.5                                                           
#> + digest        0.6.29                                                          
#> + DT            0.23                                                            
#> + evaluate      0.15                                                            
#> + fastmap       1.1.0                                                           
#> + fontawesome   0.2.2                                                           
#> + formattable   0.2.1                                                           
#> + fs            1.5.2                                                           
#> + highr         0.9                                                             
#> + htmltools     0.5.2                                                           
#> + htmlwidgets   1.5.4                                                           
#> + httpuv        1.6.5                                                           
#> + httr          1.4.3                                                           
#> + jquerylib     0.1.4                                                           
#> + jsonlite      1.8.0                                                           
#> + knitr         1.39                                                            
#> + later         1.3.0                                                           
#> + lazyeval      0.2.2                                                           
#> + mime          0.12                                                            
#> + openssl       2.0.2                                                           
#> + pkgload       1.2.4                                                           
#> + praise        1.0.0                                                           
#> + processx      3.6.1                                                           
#> + promises      1.2.0.1                                                         
#> + ps            1.7.1                                                           
#> + R6            2.5.1                                                           
#> + rappdirs      0.3.3                                                           
#> + Rcpp          1.0.8.3                                                         
#> + rematch2      2.1.2                                                           
#> + rex           1.2.1                                                           
#> + rmarkdown     2.14                                                            
#> + rprojroot     2.0.3                                                           
#> + rstudioapi    0.13                                                            
#> + sass          0.4.1                                                           
#> + shiny         1.7.1                                                           
#> + sourcetools   0.1.7                                                           
#> + stringi       1.7.6                                                           
#> + stringr       1.4.0                                                           
#> + sys           3.4                                                             
#> + testthat      3.1.4                                                           
#> + tinytex       0.40                                                            
#> + waldo         0.4.0                                                           
#> + withr         2.5.0                                                           
#> + xfun          0.31                                                            
#> + xtable        1.8-4                                                           
#> + yaml          2.3.5                                                           
#>  No downloads are needed, 57 pkgs (60.39 MB) are cached                        
#>  Got base64enc 0.1-3 (aarch64-apple-darwin20) (33.62 kB)                       
#>  Got askpass 1.1 (aarch64-apple-darwin20) (22.91 kB)                           
#>  Got R6 2.5.1 (aarch64-apple-darwin20) (82.52 kB)                              
#>  Got brio 1.1.3 (aarch64-apple-darwin20) (43.84 kB)                            
#>  Got praise 1.0.0 (aarch64-apple-darwin20) (16.08 kB)                          
#>  Got lazyeval 0.2.2 (aarch64-apple-darwin20) (159.69 kB)                       
#>  Got rappdirs 0.3.3 (aarch64-apple-darwin20) (46.80 kB)                        
#>  Got digest 0.6.29 (aarch64-apple-darwin20) (272.50 kB)                        
#>  Got rprojroot 2.0.3 (aarch64-apple-darwin20) (100.20 kB)                      
#>  Got rex 1.2.1 (aarch64-apple-darwin20) (122.38 kB)                            
#>  Got cachem 1.0.6 (aarch64-apple-darwin20) (67.65 kB)                          
#>  Got htmlwidgets 1.5.4 (aarch64-apple-darwin20) (898.05 kB)                    
#>  Got diffobj 0.3.5 (aarch64-apple-darwin20) (1.01 MB)                          
#>  Got crosstalk 1.2.0 (aarch64-apple-darwin20) (404.80 kB)                      
#>  Got testthat 3.1.4 (aarch64-apple-darwin20) (2.89 MB)                         
#>  Got sourcetools 0.1.7 (aarch64-apple-darwin20) (135.84 kB)                    
#>  Got fastmap 1.1.0 (aarch64-apple-darwin20) (178.21 kB)                        
#>  Got promises 1.2.0.1 (aarch64-apple-darwin20) (1.80 MB)                       
#>  Got callr 3.7.0 (aarch64-apple-darwin20) (435.22 kB)                          
#>  Got xtable 1.8-4 (aarch64-apple-darwin20) (701.09 kB)                         
#>  Got desc 1.4.1 (aarch64-apple-darwin20) (327.81 kB)                           
#>  Got sys 3.4 (aarch64-apple-darwin20) (50.44 kB)                               
#>  Got pkgload 1.2.4 (aarch64-apple-darwin20) (152.65 kB)                        
#>  Got ps 1.7.1 (aarch64-apple-darwin20) (308.85 kB)                             
#>  Got waldo 0.4.0 (aarch64-apple-darwin20) (99.88 kB)                           
#>  Got fs 1.5.2 (aarch64-apple-darwin20) (589.90 kB)                             
#>  Got jquerylib 0.1.4 (aarch64-apple-darwin20) (526.05 kB)                      
#>  Got yaml 2.3.5 (aarch64-apple-darwin20) (216.59 kB)                           
#>  Got formattable 0.2.1 (aarch64-apple-darwin20) (168.24 kB)                    
#>  Got withr 2.5.0 (aarch64-apple-darwin20) (229.48 kB)                          
#>  Got knitr 1.39 (aarch64-apple-darwin20) (1.44 MB)                             
#>  Got rematch2 2.1.2 (aarch64-apple-darwin20) (43.89 kB)                        
#>  Got commonmark 1.8.0 (aarch64-apple-darwin20) (319.26 kB)                     
#>  Got jsonlite 1.8.0 (aarch64-apple-darwin20) (1.12 MB)                         
#>  Got openssl 2.0.2 (aarch64-apple-darwin20) (2.48 MB)                          
#>  Got tinytex 0.40 (aarch64-apple-darwin20) (132.40 kB)                         
#>  Got mime 0.12 (aarch64-apple-darwin20) (36.16 kB)                             
#>  Got curl 4.3.2 (aarch64-apple-darwin20) (879.88 kB)                           
#>  Got highr 0.9 (aarch64-apple-darwin20) (38.77 kB)                             
#>  Got later 1.3.0 (aarch64-apple-darwin20) (622.13 kB)                          
#>  Got htmltools 0.5.2 (aarch64-apple-darwin20) (334.97 kB)                      
#>  Got httpuv 1.6.5 (aarch64-apple-darwin20) (2.72 MB)                           
#>  Got Rcpp 1.0.8.3 (aarch64-apple-darwin20) (3.34 MB)                           
#>  Got stringr 1.4.0 (aarch64-apple-darwin20) (211.53 kB)                        
#>  Got bslib 0.3.1 (aarch64-apple-darwin20) (4.81 MB)                            
#>  Got covr 3.5.1 (aarch64-apple-darwin20) (290.71 kB)                           
#>  Got httr 1.4.3 (aarch64-apple-darwin20) (505.44 kB)                           
#>  Got xfun 0.31 (aarch64-apple-darwin20) (394.01 kB)                            
#>  Got rstudioapi 0.13 (aarch64-apple-darwin20) (274.23 kB)                      
#>  Got rmarkdown 2.14 (aarch64-apple-darwin20) (3.66 MB)                         
#>  Got shiny 1.7.1 (aarch64-apple-darwin20) (4.17 MB)                            
#>  Got DT 0.23 (aarch64-apple-darwin20) (1.58 MB)                                
#>  Got fontawesome 0.2.2 (aarch64-apple-darwin20) (1.53 MB)                      
#>  Got evaluate 0.15 (aarch64-apple-darwin20) (77.09 kB)                         
#>  Got processx 3.6.1 (aarch64-apple-darwin20) (287.81 kB)                       
#>  Got sass 0.4.1 (aarch64-apple-darwin20) (2.41 MB)                             
#>  Got stringi 1.7.6 (aarch64-apple-darwin20) (14.47 MB)                         
#>  Installed R6 2.5.1  (58ms)                                                    
#>  Installed askpass 1.1  (92ms)                                                 
#>  Installed base64enc 0.1-3  (103ms)                                            
#>  Installed brio 1.1.3  (113ms)                                                 
#>  Installed callr 3.7.0  (115ms)                                                
#>  Installed covr 3.5.1  (123ms)                                                 
#>  Installed bslib 0.3.1  (160ms)                                                
#>  Installed curl 4.3.2  (156ms)                                                 
#>  Installed desc 1.4.1  (77ms)                                                  
#>  Installed diffobj 0.3.5  (62ms)                                               
#>  Installed digest 0.6.29  (40ms)                                               
#>  Installed evaluate 0.15  (28ms)                                               
#>  Installed fastmap 1.1.0  (14ms)                                               
#>  Installed fs 1.5.2  (18ms)                                                    
#>  Installed highr 0.9  (12ms)                                                   
#>  Installed htmltools 0.5.2  (14ms)                                             
#>  Installed htmlwidgets 1.5.4  (20ms)                                           
#>  Installed httr 1.4.3  (18ms)                                                  
#>  Installed jquerylib 0.1.4  (17ms)                                             
#>  Installed jsonlite 1.8.0  (22ms)                                              
#>  Installed knitr 1.39  (42ms)                                                  
#>  Installed lazyeval 0.2.2  (14ms)                                              
#>  Installed mime 0.12  (12ms)                                                   
#>  Installed openssl 2.0.2  (33ms)                                               
#>  Installed pkgload 1.2.4  (11ms)                                               
#>  Installed praise 1.0.0  (10ms)                                                
#>  Installed processx 3.6.1  (13ms)                                              
#>  Installed ps 1.7.1  (13ms)                                                    
#>  Installed rappdirs 0.3.3  (13ms)                                              
#>  Installed rematch2 2.1.2  (13ms)                                              
#>  Installed rex 1.2.1  (13ms)                                                   
#>  Installed rmarkdown 2.14  (64ms)                                              
#>  Installed rprojroot 2.0.3  (23ms)                                             
#>  Installed rstudioapi 0.13  (15ms)                                             
#>  Installed sass 0.4.1  (38ms)                                                  
#>  Installed stringi 1.7.6  (149ms)                                              
#>  Installed stringr 1.4.0  (70ms)                                               
#>  Installed sys 3.4  (84ms)                                                     
#>  Installed tinytex 0.40  (55ms)                                                
#>  Installed testthat 3.1.4  (160ms)                                             
#>  Installed waldo 0.4.0  (44ms)                                                 
#>  Installed withr 2.5.0  (43ms)                                                 
#>  Installed xfun 0.31  (69ms)                                                   
#>  Installed yaml 2.3.5  (65ms)                                                  
#>  Installed DT 0.23  (74ms)                                                     
#>  Installed cachem 1.0.6  (15ms)                                                
#>  Installed Rcpp 1.0.8.3  (111ms)                                               
#>  Installed commonmark 1.8.0  (44ms)                                            
#>  Installed crosstalk 1.2.0  (39ms)                                             
#>  Installed fontawesome 0.2.2  (64ms)                                           
#>  Installed formattable 0.2.1  (43ms)                                           
#>  Installed httpuv 1.6.5  (49ms)                                                
#>  Installed later 1.3.0  (45ms)                                                 
#>  Installed promises 1.2.0.1  (40ms)                                            
#>  Installed sourcetools 0.1.7  (19ms)                                           
#>  Installed shiny 1.7.1  (81ms)                                                 
#>  Installed xtable 1.8-4  (75ms)                                                
#>  2 pkgs + 68 deps: kept 12, added 57, dld 57 (60.28 MB) [17s]                  

The syntax is

<packagename>=?ignore

Note that you can only ignore optional dependencies, i.e. packages in Suggests and Enhances.

Others

How can I use pak with renv?

You cannot currently, but keep on eye on this issue: https://github.com/r-lib/pak/issues/343