Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in if (type == "binary") { : argument is of length zero in devtools::install() dependencies under Windows. #291

Closed
ConorIA opened this issue Feb 5, 2019 · 11 comments

Comments

@ConorIA
Copy link

ConorIA commented Feb 5, 2019

I have a colleague who was trying to install a package I have on GitLab, but the install couldn't proceed without first manually installing the dependencies. She is using Windows. Unfortunately I forgot to ask her for session info. The input was this:

pkg_name <- "canadaHCDx"
branch = "master"
url <- paste0("https://gitlab.com/ConorIA/", pkg_name, "/-/archive/", branch, "/", pkg_name, "-", branch, ".zip")
f <- tempfile()
d <- tempdir()
download.file(url, f)
unzip(f, exdir = d)
devtools::install(file.path(d, paste(pkg_name, branch, sep = "-")), dependencies = TRUE)

The output presented a series of dependencies to install, as expected:

These packages have more recent versions available.
Which would you like to update?
1: canadaHCD (0505b3f31... -> efe3209be...) [GitHub]
2: ggplot2 (3.0.0 -> 3.1.0 ) [CRAN]
3: httr (1.3.1 -> 1.4.0 ) [CRAN]
4: jsonlite (1.5 -> 1.6 ) [CRAN]
5: markdown (0.8 -> 0.9 ) [CRAN]
6: openssl (1.0.2 -> 1.2.1 ) [CRAN]
7: stringi (1.1.7 -> 1.2.4 ) [CRAN]
8: tibble (1.4.2 -> 2.0.1 ) [CRAN]
9: CRAN packages only
10: All
11: None
Enter one or more numbers separated by spaces, or an empty line to cancel

No matter what selection was chosen, the ensuing command failed with:

Installing 28 packages: gbRd, geosphere, ggplot2, gridExtra, htmlwidgets, httpuv, httr, jsonlite, later, leaflet, markdown, openssl, png, praise, promises, rappdirs, raster, Rdpack, rex, shiny, sourcetools, sp, storr, stringi, testthat, tibble, viridis, xtable

Error in if (type == "binary") { : argument is of length zero

We did get it to install by installing all of the dependencies via install.packages(), and then running the devtools::install() line again.

Was this user error on our side? If not, it seems to be something in the devtools dependency installer code. I did search in the closed issues, but if this is an old bug, I apologize.

@jimhester
Copy link
Member

jimhester commented Feb 11, 2019

This likely was an issue with options("pkgType") being NULL.

@jimhester jimhester transferred this issue from r-lib/devtools Feb 11, 2019
@ConorIA
Copy link
Author

ConorIA commented Feb 23, 2019

Thanks for the tip @jimhester. I only run Linux, and I guess getOption("pkgType") defaults to "source". The code in question is a quick install script for some packages I have hosted on GitLab. Would something like getOption("pkgType", "both") be a safe workaround to allow cross-platform installs?

@sdhutchins
Copy link

sdhutchins commented Mar 14, 2019

I just got this issue while creating a new r library to test my package installing.

> options("pkgType")
$`pkgType`
[1] "both"

I'm not sure what's causing this but I thought I'd add my comment. I'm also using Windows 7.

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0         rstudioapi_0.9.0   magrittr_1.5       usethis_1.4.0      devtools_2.0.1     pkgload_1.0.2     
 [7] R6_2.4.0           rlang_0.3.1        tools_3.5.1        pkgbuild_1.0.2     packrat_0.5.0      sessioninfo_1.1.1 
[13] cli_1.0.1          withr_2.1.2        remotes_2.0.2.9000 assertthat_0.2.0   digest_0.6.18      rprojroot_1.3-2   
[19] crayon_1.3.4       processx_3.2.1     callr_3.1.1        clisymbols_1.2.0   fs_1.2.6           ps_1.3.0          
[25] curl_3.3           testthat_2.0.1     memoise_1.1.0      glue_1.3.0.9000    compiler_3.5.1     desc_1.2.0        
[31] backports_1.1.3    prettyunits_1.0.2 

@ConorIA
Copy link
Author

ConorIA commented Mar 15, 2019

@sdhutchins, does your package have any remotes dependencies in the description? That is the only thing that is different about the package of mine that is failing to build, compared with those that build no problem.

@antoine-sachet
Copy link
Contributor

antoine-sachet commented Apr 9, 2019

@ConorIA If your remote dependencies are on a different domain (e.g. your package on gitlab with deps on github), then your gitlab credentials (host and token) are used to connect to github which obviously fails. See #337

@wlandau
Copy link

wlandau commented Apr 9, 2019

I just started seeing this here after r-lib/devtools#2020 was fixed. Any tips for Travis CI?

@jimhester
Copy link
Member

jimhester commented Apr 9, 2019

It might require a patch release of remotes, I have been unable to reproduce reliably until now, but I am also getting it in https://travis-ci.org/jimhester/vroom/builds/517979475, so I should be able to track it down.

@fernandomayer
Copy link

fernandomayer commented Apr 9, 2019

I'm getting the same here: https://travis-ci.org/leg-ufpr/estbas/builds/517993870#L1540

@rkrug
Copy link

rkrug commented Apr 10, 2019

If this helps: I can confirm this error here now: https://travis-ci.com/Exp-Micro-Ecol-Hub/emeScheme/builds/107620556

@pat-s
Copy link

pat-s commented Apr 10, 2019

It also appears when running it locally.

remotes::install_deps(dependencies = T)
These packages have more recent versions available.
Which would you like to update?

1:   All
2:   CRAN packages only
3:   None
4:   rcmdcheck (1.3.2 -> 702723cdf...) [GitHub]
5:   rlang     (0.3.3 -> 0.3.4       ) [CRAN]
6:   usethis   (1.4.0 -> 1.5.0       ) [CRAN]

Enter one or more numbers separated by spaces, or an empty line to cancel
1: 1
rcmdcheck (1.3.2 -> 702723cdf...) [GitHub]
drat      (NA    -> 0.1.5       ) [CRAN]
rlang     (0.3.3 -> 0.3.4       ) [CRAN]
usethis   (1.4.0 -> 1.5.0       ) [CRAN]
Installing 3 packages: drat, rlang, usethis
Error in if (type == "binary") { : argument is of length zero

@jimhester
Copy link
Member

jimhester commented Apr 10, 2019

This is fixed in #340

You can add the following to your travis configuration until this is fixed in the CRAN release of remotes.

r_github_packages: r-lib/remotes#340

wlandau added a commit to ropensci-books/drake that referenced this issue Apr 10, 2019
rkrug added a commit to Exp-Micro-Ecol-Hub/emeScheme that referenced this issue Apr 10, 2019
grlloyd added a commit to computational-metabolomics/structToolbox that referenced this issue Apr 11, 2019
liao961120 added a commit to twLangSurvey/twLangSurvey.github.io that referenced this issue Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants