pak icon indicating copy to clipboard operation
pak copied to clipboard

installation of package 'pak' had non-zero exit status

Open emmansh opened this issue 3 years ago • 7 comments

I have a problem installing pak on a certain machine, for which I get:

installation of package 'pak' had non-zero exit status 

It is worth noting that the machine is remote, and I don't have admin privileges. Furthermore, the only mirror the firewall permits downloading from is https://cran.microsoft.com/.

Whereas pak fails to install, many other packages get installed just fine.

Here's the call to install.packages():

> install.packages("pak")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/***/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
    binary source needs_compilation
pak  0.2.0  0.2.1             FALSE

installing the source package ‘pak’

trying URL 'https://cran.microsoft.com/src/contrib/pak_0.2.1.tar.gz'
Content type 'application/octet-stream' length 68695 bytes (67 KB)
downloaded 67 KB

CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
* installing *source* package 'pak' ...
** package 'pak' successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** building pak dependency data, this can take several minutes
** deps data (37): ..........10..........20..........30.......37
** pak dependency data is embedded
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'pak'
    finding HTML links ... done
    cache                                   html  
    handle_package_not_found                html  
    lib_status                              html  
    local_deps                              html  
    local_deps_explain                      html  
    local_install                           html  
    local_install_deps                      html  
    local_install_dev_deps                  html  
    local_package_trees                     html  
    local_system_requirements               html  
    lockfile_create                         html  
    lockfile_install                        html  
    metadata                                html  
    pak                                     html  
    pak_cleanup                             html  
    pak_install_extra                       html  
    pak_package_sources                     html  
    pak_setup                               html  
    pak_sitrep                              html  
    pak_update                              html  
    pkg_deps                                html  
    pkg_deps_explain                        html  
    pkg_deps_tree                           html  
    pkg_download                            html  
    pkg_history                             html  
    pkg_install                             html  
    pkg_name_check                          html  
    pkg_remove                              html  
    pkg_search                              html  
    pkg_status                              html  
    repo_add                                html  
    repo_get                                html  
    repo_status                             html  
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/sp360/Documents/R/win-library/4.1/pak'
Warning in install.packages :
  installation of package ‘pak’ had non-zero exit status

The downloaded source packages are in
	‘C:\Users\***\AppData\Local\Temp\RtmpiYhNvm\downloaded_packages’

and my session info:

- Session info  ------------------------------------------------------------------------------------------------------------------------------------------------
 hash: man: medium-light skin tone, red hair, dvd, eject button

 setting  value
 version  R version 4.1.0 (2021-05-18)
 os       Windows Server x64 (build 17763)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 date     2021-12-21
 rstudio  1.4.1106 Tiger Daylily (desktop)
 pandoc   2.12 @ C:/PROGRA~3/ANACON~1/Scripts/ (via rmarkdown)

- Packages -----------------------------------------------------------------------------------------------------------------------------------------------------
 package     * version date (UTC) lib source
 assertthat    0.2.1   2019-03-21 [2] CRAN (R 4.1.0)
 backports     1.3.0   2021-10-27 [1] CRAN (R 4.1.1)
 callr         3.7.0   2021-04-20 [2] CRAN (R 4.1.0)
 cli           3.1.0   2021-10-27 [1] CRAN (R 4.1.1)
 clipr         0.7.1   2020-10-08 [2] CRAN (R 4.1.0)
 crayon        1.4.2   2021-10-29 [1] CRAN (R 4.1.1)
 DBI           1.1.1   2021-01-15 [2] CRAN (R 4.1.0)
 digest        0.6.28  2021-09-23 [1] CRAN (R 4.1.1)
 dplyr         1.0.7   2021-06-18 [1] CRAN (R 4.1.1)
 ellipsis      0.3.2   2021-04-29 [2] CRAN (R 4.1.0)
 evaluate      0.14    2019-05-28 [2] CRAN (R 4.1.0)
 fansi         0.5.0   2021-05-25 [1] CRAN (R 4.1.1)
 fastmap       1.1.0   2021-01-25 [2] CRAN (R 4.1.0)
 fs            1.5.0   2020-07-31 [2] CRAN (R 4.1.0)
 generics      0.1.1   2021-10-25 [1] CRAN (R 4.1.1)
 glue          1.5.0   2021-11-07 [1] CRAN (R 4.1.2)
 highr         0.9     2021-04-16 [2] CRAN (R 4.1.0)
 htmltools     0.5.2   2021-08-25 [1] CRAN (R 4.1.1)
 knitr         1.36    2021-09-29 [1] CRAN (R 4.1.1)
 lifecycle     1.0.1   2021-09-24 [1] CRAN (R 4.1.1)
 magrittr      2.0.1   2020-11-17 [2] CRAN (R 4.1.0)
 pillar        1.6.4   2021-10-18 [1] CRAN (R 4.1.1)
 pkgconfig     2.0.3   2019-09-22 [2] CRAN (R 4.1.0)
 plyr          1.8.6   2020-03-03 [2] CRAN (R 4.1.0)
 pROC          1.18.0  2021-09-03 [1] CRAN (R 4.1.1)
 processx      3.5.2   2021-04-30 [2] CRAN (R 4.1.0)
 ps            1.6.0   2021-02-28 [2] CRAN (R 4.1.0)
 purrr         0.3.4   2020-04-17 [2] CRAN (R 4.1.0)
 R.cache       0.15.0  2021-04-30 [1] CRAN (R 4.1.1)
 R.methodsS3   1.8.1   2020-08-26 [1] CRAN (R 4.1.1)
 R.oo          1.24.0  2020-08-26 [1] CRAN (R 4.1.1)
 R.utils       2.11.0  2021-09-26 [1] CRAN (R 4.1.1)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.1.1)
 Rcpp          1.0.7   2021-07-07 [1] CRAN (R 4.1.1)
 reprex      * 2.0.1   2021-08-05 [1] CRAN (R 4.1.1)
 rlang         0.4.12  2021-10-18 [1] CRAN (R 4.1.1)
 rmarkdown     2.11    2021-09-14 [1] CRAN (R 4.1.1)
 rstudioapi    0.13    2020-11-12 [2] CRAN (R 4.1.0)
 sessioninfo   1.2.1   2021-11-02 [1] CRAN (R 4.1.2)
 styler        1.6.2   2021-09-23 [1] CRAN (R 4.1.1)
 tibble        3.1.5   2021-09-30 [1] CRAN (R 4.1.1)
 tidyselect    1.1.1   2021-04-30 [2] CRAN (R 4.1.0)
 tinytex       0.35    2021-11-04 [1] CRAN (R 4.1.2)
 utf8          1.2.2   2021-07-24 [1] CRAN (R 4.1.1)
 vctrs         0.3.8   2021-04-29 [2] CRAN (R 4.1.0)
 withr         2.4.2   2021-04-18 [2] CRAN (R 4.1.0)
 xfun          0.27    2021-10-18 [1] CRAN (R 4.1.1)
 yaml          2.2.1   2020-02-01 [2] CRAN (R 4.1.0)
 yardstick     0.0.9   2021-11-22 [1] CRAN (R 4.1.2)

 [1] C:/Users/***/Documents/R/win-library/4.1
 [2] C:/Program Files/R/R-4.1.0/library

emmansh avatar Dec 21 '21 16:12 emmansh

I am not sure why the 32 bit installation fails, but you probably don't need that, anyway, so maybe this works:

install.packages("pak", INSTALL_opts="--no-test-load")

Alternatively you can install the development version, that is a binary, like this:

install.packages("pak", repos = "https://r-lib.github.io/p/pak/devel/")

See https://github.com/r-lib/pak#installation

gaborcsardi avatar Dec 21 '21 16:12 gaborcsardi

Thanks @gaborcsardi !

I successfully installed pak via

install.packages("pak", INSTALL_opts="--no-test-load")

However, pak::pkg_install() doesn't work for me. For example, I tried to install here package:

> library(pak)
> 
> pkg_install("here")

v Loading metadata database ... done
Error: Cannot install packages:                                            
* here: Can't subset columns that don't exist.
x Columns `license` and `md5sum` don't exist.
Type .Last.error.trace to see where the error occurred
> 
> .Last.error.trace

 Stack trace:

 12. (function (...)  ...
 13. base:::withCallingHandlers(cli_message = function(msg) { ...
 14. get("pkg_install_make_plan", asNamespace("pak"))(...)
 15. prop$stop_for_solution_error()
 16. private$plan$stop_for_solve_error()
 17. pkgdepends:::pkgplan_stop_for_solve_error(self, private)
 18. base:::stop("Cannot install packages:\n", msg, call. = FALSE)
 19. base:::.handleSimpleError(function (e)  ...
 20. h(simpleError(msg, call))
 21. base:::stop(e)
 22. (function (e)  ...

 x Cannot install packages:
* here: Can't subset columns that don't exist.
x Columns `license` and `md5sum` don't exist. 

By contrast, install.packages("here") does work.

emmansh avatar Dec 22 '21 08:12 emmansh

Try running pak::cache_clean() first. What does pak::repo_get() show? What does pak::meta_list() show?

gaborcsardi avatar Dec 22 '21 08:12 gaborcsardi

Unfortunately pak::cache_clean() doesn't make any difference. pak::meta_list() gives an empty table.

> pak::cache_clean()

> library(pak)
> pkg_install("here")
v Loading metadata database ... done
Error: Cannot install packages:                                            
* here: Can't subset columns that don't exist.
x Columns `license` and `md5sum` don't exist.
Type .Last.error.trace to see where the error occurred

> pak::repo_get()
# A tibble: 5 x 5
  name          url                                                    type  r_version bioc_version
  <chr>         <chr>                                                  <chr> <chr>     <chr>       
1 CRAN          https://cran.microsoft.com                             cran  *         NA          
2 BioCsoft      https://bioconductor.org/packages/3.14/bioc            bioc  4.1.0     3.14        
3 BioCann       https://bioconductor.org/packages/3.14/data/annotation bioc  4.1.0     3.14        
4 BioCexp       https://bioconductor.org/packages/3.14/data/experiment bioc  4.1.0     3.14        
5 BioCworkflows https://bioconductor.org/packages/3.14/workflows       bioc  4.1.0     3.14        

> pak::meta_list()
# A tibble: 0 x 20
# ... with 20 variables: repodir <chr>, rversion <chr>, platform <chr>, needscompilation <chr>, priority <chr>, package <chr>, version <chr>, ref <chr>, type <chr>, direct <lgl>, status <chr>, target <chr>,
#   mirror <chr>, sources <list>, filesize <int>, published <chr>, built <chr>, sysreqs <chr>, sha256 <chr>, deps <list>
> 

emmansh avatar Dec 22 '21 08:12 emmansh

Sorry, I should have said this, after a restart:

pak::meta_clean()
pak::meta_summary()
pak::meta_list()

And also this:

download.file("https://cran2.r-pkg.org/metadata/bin/windows/contrib/4.1/METADATA2.gz", tempfile())

I guess this fails for you?

gaborcsardi avatar Dec 22 '21 09:12 gaborcsardi

Thanks. So pak::meta_clean() and pak::meta_summary() run with no problem. However, pak::meta_list() is still hanging (after several minutes). See below.

As of

download.file("https://cran2.r-pkg.org/metadata/bin/windows/contrib/4.1/METADATA2.gz", tempfile())

I assume it won't run because of the firewall. Only microsoft.com domain is allowed.


> pak::meta_clean()
? Do you want to delete all package metadata (Y/n) Y
i Cleaning up cache directory C:\Users\***\AppData\Local\R\cache\R\pkgcache/_metadata.
> pak::meta_summary()
$cachepath
[1] "C:\\Users\\***\\AppData\\Local\\R\\cache\\R\\pkgcache/_metadata"

$current_db
[1] "C:\\Users\\***\\AppData\\Local\\R\\cache\\R\\pkgcache/_metadata/pkgs-9b1db897d6.rds"

$raw_files
character(0)

$db_files
character(0)

$size
[1] 0

> pak::meta_list()
- Updating metadata database [0/12] | Downloading [0 B / 0 B]

EDIT


After 15 minutes or so, pak::meta_list() finished:

> pak::meta_list()
v Updated metadata database: 0 B in 12 files.                
i R 4.1 x86_64-w64-mingw32 packages are missing from CRAN and Bioconductor
i source packages are missing from CRAN and Bioconductor
v Updating metadata database ... done
# A tibble: 0 x 20
# ... with 20 variables: repodir <chr>, rversion <chr>, platform <chr>, needscompilation <chr>, priority <chr>, package <chr>, version <chr>, ref <chr>, type <chr>, direct <lgl>, status <chr>, target <chr>,
#   mirror <chr>, sources <list>, filesize <int>, published <chr>, built <chr>, sysreqs <chr>, sha256 <chr>, deps <list>

EDIT 2


As predicted, the firewall blocks downloading https://cran2.r-pkg.org/metadata/bin/windows/contrib/4.1/METADATA2.gz:

> download.file("https://cran2.r-pkg.org/metadata/bin/windows/contrib/4.1/METADATA2.gz", tempfile())

trying URL 'https://cran2.r-pkg.org/metadata/bin/windows/contrib/4.1/METADATA2.gz'
Error in download.file("https://cran2.r-pkg.org/metadata/bin/windows/contrib/4.1/METADATA2.gz",  : 
  cannot open URL 'https://cran2.r-pkg.org/metadata/bin/windows/contrib/4.1/METADATA2.gz'
In addition: Warning message:
In download.file("https://cran2.r-pkg.org/metadata/bin/windows/contrib/4.1/METADATA2.gz",  :
  cannot open URL 'https://cran2.r-pkg.org/metadata/bin/windows/contrib/4.1/METADATA2.gz': HTTP status was '403 URLBlocked'

emmansh avatar Dec 22 '21 09:12 emmansh

This is most probably a bug in pak, will fix it soon.

gaborcsardi avatar Dec 22 '21 11:12 gaborcsardi