`devtools::install_deps(dependencies = TRUE)` doesn't install all dependent packages #1370

Closed
fyears opened this Issue Oct 6, 2016 · 5 comments

Projects

None yet

5 participants

@fyears
fyears commented Oct 6, 2016 edited

short description

Expect: the same behavior as install.packages, installing all necessary dependencies.
Actual: not installing any dependencies.

long description

I am using the latest devtools from github as of 20161006.

A min example, in DESCRIPTION file,

Package: test
Imports:
  ggplot2
Remotes:
  hadley/bookdown

Then run this in R:

devtools::install_deps(dependencies = TRUE)
# or just
# devtools::install_deps()

## Installing 1 package: ggplot2
## Installing package into ‘~/Rpkgs’
## trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/ggplot2_2.1.0.zip'
## Content type 'application/zip' length 1996146 bytes (1.9 MB)
## downloaded 1.9 MB
## 
## package ‘ggplot2’ successfully unpacked and MD5 sums checked
## 
## The downloaded binary packages are in
##  C:\Users\fyears\AppData\Local\Temp\RtmpaaTy7S\downloaded_packages

The ggplot2 is installed. However, its dependencies (stringi, magrittr, ...) are not installed!

Instead, running the default command:

install.packages('ggplot2')
## Installing package into ‘~/Rpkgs’
## also installing the dependencies ‘stringi’, ‘magrittr’, ‘colorspace’, ‘Rcpp’, ‘stringr’, ‘RColorBrewer’, ## ‘dichromat’, ‘munsell’, ‘labeling’, ‘gtable’, ‘plyr’, ‘reshape2’, ‘scales’
## 
## trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/stringi_1.1.2.zip'
## Content type 'application/zip' length 14264581 bytes (13.6 MB)
## downloaded 13.6 MB
## ...

Moreover, the remote hadley/bookdown is not installed

@jimhester
Collaborator

This is a known issue with the current CRAN version see #1246, #1343 and should be fixed in the development version. You can install it on windows with

library(devtools)
build_github_devtools()

#### Restart R before continuing ####
install.packages("devtools.zip", repos = NULL, type = "source")

# Remove the package after installation
unlink("devtools.zip")
@jimhester jimhester closed this Oct 6, 2016
@fyears
fyears commented Oct 7, 2016

It's weird. Actually I tried devtools::install_github('hadley/devtools') before...

Maybe that's because in the actual DESCRIPTION the item devtools reset it into the cran repo version.

@krlmlr
Contributor
krlmlr commented Jan 9, 2017 edited

I'm still observing this or a similar issue on Windows with devtools 1.12.0. See the AppVeyor test for tibble, it now suggests dplyr; dplyr is installed but imports DBI which is not installed. The same tibble version works on Travis.

@renozao
renozao commented Jan 18, 2017

This issue is still present on the current CRAN version (1.12.0). Only affects Windows. This is a blocking bug, which affect all install_* functions.
Can we hope for a hotfix pushed to CRAN soon? See hints below for quick fix.
Thanks

The bug is reproducible by calling install_cran on any package that has a direct dependency that is not already installed on the host. For example:

install_cran('argparse')

will not install dependency getopt if not there.

If I correctly followed the chain of calls, I think the issue lies in install_remote, which contains the following block:

if (is_windows && inherits(remote, "cran_remote")) {
        install_packages(package_name, repos = remote$repos, 
            type = remote$pkg_type, ..., quiet = quiet)
        return(invisible(TRUE))
    }

This explains the Windows-specificity of the bug.
The issue then arises from function install_packages that has default argument dependencies = FALSE, instead of the standard and expected dependencies = NA.
Note that this notably affect all install_* functions because they all eventually call install_remote.

@sfirke
sfirke commented Feb 10, 2017

I experience this on Windows 10 both with CRAN version 1.12.0 as noted by @renozao, also with today's current development version 1.21.0.9000 (below htmlwidgets is a dependency of formattable, which my package depends on):

> library(devtools)
> session_info()
Session info ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.2 (2016-10-31)
 system   x86_64, mingw32             
 ui       RStudio (1.0.136)           
 language (EN)                        
 collate  English_United States.1252  
 tz       America/New_York            
 date     2017-02-09                  

Packages -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 package  * version     date       source                          
 devtools * 1.12.0.9000 2017-02-10 local                           
 digest     0.6.12      2017-01-27 CRAN (R 3.3.2)                  
 memoise    1.0.0       2016-01-29 CRAN (R 3.3.0)                  
 pkgbuild   0.0.0.9000  2017-02-09 Github (r-pkgs/pkgbuild@65eace0)
 pkgload    0.0.0.9000  2017-02-09 Github (r-pkgs/pkgload@def2b10) 
 withr      1.0.2       2016-06-20 CRAN (R 3.3.1)                  
> devtools::install_git("https://tools.tntp.org/bitbucket/scm/ct/tntpr.git")
Downloading git repo https://tools.tntp.org/bitbucket/scm/ct/tntpr.git
Installing tntpr
Installation failed: install_packages(package_name, repos = remote$repos, type = remote$pkg_type,      dependencies = NA, ..., quiet = quiet, out_dir = out_dir,      skip_if_log_exists = skip_if_log_exists) : formal argument "repos" matched by multiple actual arguments
Installation failed: install_packages(package_name, repos = remote$repos, type = remote$pkg_type,      dependencies = NA, ..., quiet = quiet, out_dir = out_dir,      skip_if_log_exists = skip_if_log_exists) : formal argument "repos" matched by multiple actual arguments
Installation failed: install_packages(package_name, repos = remote$repos, type = remote$pkg_type,      dependencies = NA, ..., quiet = quiet, out_dir = out_dir,      skip_if_log_exists = skip_if_log_exists) : formal argument "repos" matched by multiple actual arguments
Installation failed: install_packages(package_name, repos = remote$repos, type = remote$pkg_type,      dependencies = NA, ..., quiet = quiet, out_dir = out_dir,      skip_if_log_exists = skip_if_log_exists) : formal argument "repos" matched by multiple actual arguments
"C:/PROGRA~1/R/R-33~1.2/bin/x64/Rcmd.exe" INSTALL "C:/Users/SFirke/AppData/Local/Temp/RtmpigYaP7/file3474161d1fa5" 
Installation failed: NULL : Command failed:
 "C:/PROGRA~1/R/R-33~1.2/bin/x64/Rcmd.exe" INSTALL "C:/Users/SFirke/AppData/Local/Temp/RtmpigYaP7/file3474161d1fa5"  
 * installing to library 'C:/Users/SFirke/Documents/R/win-library/3.3'
* installing *source* package 'tntpr' ...
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called 'htmlwidgets'
ERROR: lazy loading failed for package 'tntpr'
* removing 'C:/Users/SFirke/Documents/R/win-library/3.3/tntpr'

As an interim workaround, I installed devtools 1.11.1 from April 2016 and it runs the install_git() command successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment