pak icon indicating copy to clipboard operation
pak copied to clipboard

validate presence of build tools earlier on?

Open kevinushey opened this issue 2 years ago • 5 comments

For example, I saw (on Windows with R 3.6.3):

v Updated metadata database: 4.60 MB in 12 files.                               
v Updating metadata database ... done                                           
                                                                                 
> Will install 66 packages.
> Will update 19 packages.
> Will download 85 CRAN packages (42.45 MB).
+ askpass               1.1     [dl] (243.56 kB)
+ brew                  1.0-7   [bld][dl] (55.52 kB)
+ brio                  1.1.3   [bld][cmp][dl] (12.63 kB)
+ cachem                1.0.6   [bld][cmp][dl] (25.41 kB)
+ callr                 3.7.0   [dl] (439.29 kB)
+ cli         3.3.0   > 3.3.0   [bld][cmp][dl] (495.82 kB)
+ clipr                 0.8.0   [bld][dl] (21.90 kB)
+ commonmark            1.8.0   [bld][cmp][dl] (139.48 kB)
+ covr                  3.5.1   [dl] (305.78 kB)
+ cpp11                 0.4.2   [bld][dl] (317.71 kB)
+ crayon                1.5.1   [bld][dl] (40.18 kB)
+ credentials           1.3.2   [bld][dl] (230.07 kB)
+ curl                  4.3.2   [bld][cmp][dl] (793.35 kB)
+ desc                  1.4.1   [bld][dl] (80.67 kB)
+ devtools              2.4.3   [bld][dl] (372.41 kB)
+ diffobj               0.3.5   [bld][cmp][dl] (479.28 kB)
+ digest      0.6.27  > 0.6.29  [bld][cmp][dl] (162.78 kB)
+ ellipsis              0.3.2   [dl] (48.95 kB)
+ evaluate              0.15    [bld][dl] (25.62 kB)
+ fansi                 1.0.3   [bld][cmp][dl] (481.16 kB)
+ fastmap               1.1.0   [dl] (215.44 kB)
+ fs                    1.5.2   [bld][cmp][dl] (793.63 kB)
+ gert                  1.6.0   [bld][cmp][dl] (117.92 kB)
+ gh                    1.3.0   [dl] (141.47 kB)
+ gitcreds              0.1.1   [dl] (97.25 kB)
+ glue        1.6.2   > 1.6.2   [bld][cmp][dl] (106.51 kB)
+ here                  1.0.1   [dl] (64.08 kB)
+ highr                 0.9     [dl] (46.57 kB)
+ httpuv      1.6.1   > 1.6.5   [bld][cmp][dl] (1.82 MB)
+ httr                  1.4.3   [bld][dl] (161.12 kB)
+ ini                   0.3.1   [dl] (15.67 kB)
+ jsonlite    1.7.2   > 1.8.0   [bld][cmp][dl] (1.05 MB)
+ knitr       1.37    > 1.39    [bld][dl] (898.42 kB)
+ later       1.2.0   > 1.3.0   [bld][cmp][dl] (63.78 kB)
+ lattice     0.20-38 > 0.20-45 [bld][cmp][dl] (399.47 kB)
+ lazyeval              0.2.2   [dl] (172.22 kB)
+ lifecycle             1.0.1   [bld][dl] (99.72 kB)
+ magrittr    2.0.1   > 2.0.3   [bld][cmp][dl] (267.07 kB)
+ Matrix      1.2-18  > 1.4-1   [bld][cmp][dl] (2.86 MB)
+ memoise               2.0.1   [bld][dl] (17.85 kB)
+ mime                  0.12    [bld][cmp][dl] (12.56 kB)
+ openssl               2.0.0   [bld][cmp][dl] (1.20 MB)
+ pak         0.3.0   > 0.3.0   [bld][dl] (88.56 kB)
+ pillar                1.7.0   [bld][dl] (529.67 kB)
+ pkgbuild              1.3.1   [bld][dl] (31.94 kB)
+ pkgconfig             2.0.3   [dl] (22.19 kB)
+ pkgload               1.2.4   [bld][dl] (62.83 kB)
+ png                   0.1-7   [dl] (336.64 kB)
+ prettyunits           1.1.1   [dl] (37.80 kB)
+ processx              3.5.3   [bld][cmp][dl] (142.00 kB)
+ ps                    1.7.0   [bld][cmp][dl] (125.45 kB)
+ purrr                 0.3.4   [dl] (429.89 kB)
+ R6                    2.5.1   [bld][dl] (63.42 kB)
+ rappdirs              0.3.3   [dl] (58.72 kB)
+ rcmdcheck             1.4.0   [bld][dl] (73.52 kB)
+ Rcpp        1.0.6   > 1.0.8.3 [bld][cmp][dl] (3.09 MB)
+ RcppTOML              0.1.7   [dl] (971.39 kB)
+ rematch2              2.1.2   [dl] (47.45 kB)
+ remotes               2.4.2   [bld][dl] (152.54 kB)
+ reticulate            1.24    [bld][cmp][dl] (1.54 MB)
+ rex                   1.2.1   [bld][dl] (93.58 kB)
+ rlang       0.4.11  > 1.0.2   [bld][cmp][dl] (724.83 kB)
+ rmarkdown   2.11    > 2.14    [bld][dl] (3.24 MB)
+ roxygen2              7.1.2   [bld][cmp][dl] (267.34 kB)
+ rprojroot             2.0.3   [bld][dl] (59.94 kB)
+ rstudioapi            0.13    [dl] (302.84 kB)
+ rversions             2.1.1   [bld][dl] (42.06 kB)
+ sass        0.4.0   > 0.4.1   [bld][cmp][dl] (3.02 MB)
+ stringi     1.6.1   > 1.7.6   [bld][cmp][dl] (7.60 MB)
+ sys                   3.4     [dl] (59.84 kB)
+ testthat              3.1.4   [bld][cmp][dl] (700.92 kB)
+ tibble                3.1.7   [bld][cmp][dl] (674.87 kB)
+ tinytex     0.36    > 0.38    [bld][dl] (32.14 kB)
+ usethis               2.1.5   [bld][dl] (334.91 kB)
+ utf8                  1.2.2   [bld][cmp][dl] (240.33 kB)
+ uuid                  1.1-0   [bld][cmp][dl] (77.96 kB)
+ vctrs                 0.4.1   [bld][cmp][dl] (916.78 kB)
+ waldo                 0.4.0   [bld][dl] (37.56 kB)
+ whisker               0.4     [dl] (83.26 kB)
+ withr                 2.5.0   [bld][dl] (102.09 kB)
+ xfun        0.29    > 0.30    [bld][cmp][dl] (125.83 kB)
+ xml2                  1.3.3   [bld][cmp][dl] (283.96 kB)
+ xopen                 1.0.0   [dl] (24.70 kB)
+ yaml        2.2.1   > 2.3.5   [bld][cmp][dl] (94.53 kB)
+ zip                   2.2.0   [bld][cmp][dl] (114.39 kB)
? Do you want to continue (Y/n) y
i Getting 85 pkgs (42.45 MB)
v Got askpass 1.1 (i386+x86_64-w64-mingw32) (64.70 kB)                           
v Got glue 1.6.2 (source) (106.51 kB)                                            
v Got sys 3.4 (i386+x86_64-w64-mingw32) (59.98 kB)                               
v Got crayon 1.5.1 (source) (40.18 kB)                                           
v Got cli 3.3.0 (source) (495.82 kB)                                             
v Got lazyeval 0.2.2 (i386+x86_64-w64-mingw32) (172.56 kB)                       
v Got covr 3.5.1 (i386+x86_64-w64-mingw32) (306.13 kB)                           
v Got httr 1.4.3 (source) (161.12 kB)                                            
v Got mime 0.12 (source) (12.56 kB)                                              
v Got digest 0.6.29 (source) (162.78 kB)                                         
v Got rex 1.2.1 (source) (93.58 kB)                                              
v Got openssl 2.0.0 (source) (1.20 MB)                                           
v Got withr 2.5.0 (source) (102.09 kB)                                           
v Got curl 4.3.2 (source) (793.35 kB)                                            
v Got ellipsis 0.3.2 (i386+x86_64-w64-mingw32) (49.19 kB)                        
v Got gh 1.3.0 (i386+x86_64-w64-mingw32) (141.60 kB)                             
v Got gitcreds 0.1.1 (i386+x86_64-w64-mingw32) (97.33 kB)                        
v Got highr 0.9 (i386+x86_64-w64-mingw32) (46.63 kB)                             
v Got callr 3.7.0 (i386+x86_64-w64-mingw32) (438.64 kB)                          
v Got ini 0.3.1 (i386+x86_64-w64-mingw32) (15.69 kB)                             
v Got pkgconfig 2.0.3 (i386+x86_64-w64-mingw32) (22.19 kB)                       
v Got jsonlite 1.8.0 (source) (1.05 MB)                                          
v Got rappdirs 0.3.3 (i386+x86_64-w64-mingw32) (58.75 kB)                        
v Got whisker 0.4 (i386+x86_64-w64-mingw32) (83.32 kB)                           
v Got fastmap 1.1.0 (i386+x86_64-w64-mingw32) (432.04 kB)                        
v Got prettyunits 1.1.1 (i386+x86_64-w64-mingw32) (37.74 kB)                     
v Got rematch2 2.1.2 (i386+x86_64-w64-mingw32) (47.51 kB)                        
v Got xopen 1.0.0 (i386+x86_64-w64-mingw32) (24.69 kB)                           
v Got brew 1.0-7 (source) (55.52 kB)                                             
v Got brio 1.1.3 (source) (12.63 kB)                                             
v Got cachem 1.0.6 (source) (25.41 kB)                                           
v Got clipr 0.8.0 (source) (21.90 kB)                                            
v Got commonmark 1.8.0 (source) (139.48 kB)                                      
v Got credentials 1.3.2 (source) (230.07 kB)                                     
v Got cpp11 0.4.2 (source) (317.71 kB)                                           
v Got desc 1.4.1 (source) (80.67 kB)                                             
v Got devtools 2.4.3 (source) (372.41 kB)                                        
v Got evaluate 0.15 (source) (25.62 kB)                                          
v Got gert 1.6.0 (source) (117.92 kB)                                            
v Got lifecycle 1.0.1 (source) (99.72 kB)                                        
v Got fs 1.5.2 (source) (793.63 kB)                                              
v Got purrr 0.3.4 (i386+x86_64-w64-mingw32) (430.78 kB)                          
v Got magrittr 2.0.3 (source) (267.07 kB)                                        
v Got memoise 2.0.1 (source) (17.85 kB)                                          
v Got diffobj 0.3.5 (source) (479.28 kB)                                         
v Got fansi 1.0.3 (source) (481.16 kB)                                           
v Got pkgbuild 1.3.1 (source) (31.94 kB)                                         
v Got pkgload 1.2.4 (source) (62.83 kB)                                          
v Got ps 1.7.0 (source) (125.45 kB)                                              
v Got processx 3.5.3 (source) (142.00 kB)                                        
v Got rcmdcheck 1.4.0 (source) (73.52 kB)                                        
v Got rprojroot 2.0.3 (source) (59.94 kB)                                        
v Got pillar 1.7.0 (source) (529.67 kB)                                          
v Got rversions 2.1.1 (source) (42.06 kB)                                        
v Got rlang 1.0.2 (source) (724.83 kB)                                           
v Got utf8 1.2.2 (source) (240.33 kB)                                            
v Got tibble 3.1.7 (source) (674.87 kB)                                          
v Got usethis 2.1.5 (source) (334.91 kB)                                         
v Got waldo 0.4.0 (source) (37.56 kB)                                            
v Got xfun 0.30 (source) (125.83 kB)                                             
v Got xml2 1.3.3 (source) (283.96 kB)                                            
v Got vctrs 0.4.1 (source) (916.78 kB)                                           
v Got Rcpp 1.0.8.3 (source) (3.09 MB)                                            
v Got zip 2.2.0 (source) (114.39 kB)                                             
v Got knitr 1.39 (source) (898.42 kB)                                            
v Got later 1.3.0 (source) (63.78 kB)                                            
v Got pak 0.3.0 (source) (88.56 kB)                                              
v Got R6 2.5.1 (source) (63.42 kB)                                               
v Got remotes 2.4.2 (source) (152.54 kB)                                         
v Got here 1.0.1 (i386+x86_64-w64-mingw32) (64.05 kB)                            
v Got png 0.1-7 (i386+x86_64-w64-mingw32) (292.79 kB)                            
v Got httpuv 1.6.5 (source) (1.82 MB)                                            
v Got RcppTOML 0.1.7 (i386+x86_64-w64-mingw32) (784.07 kB)                       
v Got lattice 0.20-45 (source) (399.47 kB)                                       
v Got sass 0.4.1 (source) (3.02 MB)                                              
v Got tinytex 0.38 (source) (32.14 kB)                                           
v Got rstudioapi 0.13 (i386+x86_64-w64-mingw32) (302.31 kB)                      
v Got reticulate 1.24 (source) (1.54 MB)                                         
v Got testthat 3.1.4 (source) (700.92 kB)                                        
v Got uuid 1.1-0 (source) (77.96 kB)                                             
v Got yaml 2.3.5 (source) (94.53 kB)                                             
v Got Matrix 1.4-1 (source) (2.86 MB)                                           
v Got rmarkdown 2.14 (source) (3.24 MB)                                   
v Got roxygen2 7.1.2 (source) (267.34 kB)                                 
v Got stringi 1.7.6 (source) (7.60 MB)                                    
v Downloaded 85 packages (42.26 MB)in 12s                                 
i Building glue 1.6.2
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
Type .Last.error.trace to see where the error occurred

On Windows, would it be possible for pak to check (and maybe prompt) the user to install Rtools prior to attempting to build packages from sources which will require compilation?

kevinushey avatar May 04 '22 21:05 kevinushey

In addition, the error message is a bit misleading since pkgbuild isn't actually installed in the user library (it's bundled with pak) so running this won't actually work directly:

Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.

kevinushey avatar May 04 '22 21:05 kevinushey

The issue is that it is not always easy to decide if a compiler is needed or not. Not all source packages need a compiler.

In practice all downloaded packages are cached, so it you install Rtools after the error, and then restart the installation, you don't lose much time.

gaborcsardi avatar May 05 '22 06:05 gaborcsardi

Is there some opportunity to read the NeedsCompilation field from each package's DESCRIPTION file in the solve phase? (not sure if pak has access to those that early)

kevinushey avatar May 05 '22 17:05 kevinushey

Most of the time, yes. But e.g. for packages on GH, no, unless the maintainer manually adds it.

gaborcsardi avatar May 05 '22 18:05 gaborcsardi

For packages on GitHub, you could probably infer whether compilation is required via some call to the GitHub API (e.g. to see if there's a src folder).

All that said I realize this is low priority.

kevinushey avatar May 05 '22 21:05 kevinushey