0
votes

Good morning from Australia,

Since our computers at work do not have internet access, I've asked our IT Manager to download all the R packages and place them in a shared network location. I've since transferred those 4GB of packages to my a local directory: E:/R-3.3.1/MyRPackages/src/contrib/______.tar.gz

I would like my packages to be installed in E:\R-3.3.1\library

I am using Windows 7 Professional, 64-bit, along with RStudio and R version 3.3.1 (2016-06-21).

I simply would like to install.packages and install a package from my local repo, including all its dependencies.

I've tried reading up on this and tried several permutations of the install.packages command, but am not having luck. For example,

install.packages("E:/R-3.3.1/MyRPackages/src/contrib/devtools_1.12.0.tar.gz",dependencies = TRUE,repos = NULL)

ERROR: dependencies 'httr', 'memoise', 'whisker', 'digest', 'rstudioapi', 'jsonlite', 'git2r', 'withr' are not available for package 'devtools' * removing 'E:/R-3.3.1/library/devtools' Warning in install.packages : running command '"E:/R-33~1.1/bin/x64/R" CMD INSTALL -l "E:\R-3.3.1\library" "E:/R-3.3.1/MyRPackages/src/contrib/devtools_1.12.0.tar.gz"' had status 1 Warning in install.packages : installation of package ‘E:/R-3.3.1/MyRPackages/src/contrib/devtools_1.12.0.tar.gz’ had non-zero exit status

install.packages("E:/R-3.3.1/MyRPackages/src/contrib/devtools_1.12.0.tar.gz",dependencies = TRUE,repos = NULL,lib="E:/R-3.3.1/library")

ERROR: dependencies 'httr', 'memoise', 'whisker', 'digest', 'rstudioapi', 'jsonlite', 'git2r', 'withr' are not available for package 'devtools' * removing 'E:/R-3.3.1/library/devtools' Warning in install.packages : running command '"E:/R-33~1.1/bin/x64/R" CMD INSTALL -l "E:\R-3.3.1\library" "E:/R-3.3.1/MyRPackages/src/contrib/devtools_1.12.0.tar.gz"' had status 1 Warning in install.packages : installation of package ‘E:/R-3.3.1/MyRPackages/src/contrib/devtools_1.12.0.tar.gz’ had non-zero exit status

install.packages("E:/R-3.3.1/MyRPackages/src/contrib/devtools_1.12.0.tar.gz",dependencies = TRUE,repos = NULL,lib="E:/R-3.3.1/library",type = "source")

ERROR: dependencies 'httr', 'memoise', 'whisker', 'digest', 'rstudioapi', 'jsonlite', 'git2r', 'withr' are not available for package 'devtools' * removing 'E:/R-3.3.1/library/devtools' Warning in install.packages : running command '"E:/R-33~1.1/bin/x64/R" CMD INSTALL -l "E:\R-3.3.1\library" "E:/R-3.3.1/MyRPackages/src/contrib/devtools_1.12.0.tar.gz"' had status 1 Warning in install.packages : installation of package ‘E:/R-3.3.1/MyRPackages/src/contrib/devtools_1.12.0.tar.gz’ had non-zero exit status

2
Since your repos=NULL, R won't know where to look for the dependencies, so you'll need to download them as well, and install them beforehand. Is there a reason you're not using eg install.packages("devtools")? ... sorry, should have read your first sentence!rosscova
Since you're using Windows, you should install the binaries (zip files). This will be a lot easier than compiling packages from source. Alternatively, you could simply unzip each zip file into e:/R-3.3.1/library.Hong Ooi
I am currently unzipping them into my library, but when I try to load the packages using library('package_name') it says "Error in libary("blah") : "Blah" is not a valid install packageAmericanTourist
if you have the files can you not use library(tools) ; write_PACKAGESuser20650
@user20650 is correct. write_PACKAGES is (one of) the tools you need to establish the infrastructure that R uses to establish dependencies. You might also look at the drat packageBen Bolker

2 Answers

2
votes

Following up on @rosscova's answer a bit: there are various tools for determining the complete recursive set of dependencies for a package. With a little more work you could write a script to grab them all (this is indeed very likely to have been done by someone, somewhere already ...)

## dependencies=TRUE 
devtools::package_deps("devtools",dependencies=TRUE)
(p <- package_deps("devtools",dependencies=TRUE))
Needs update -----------------------------
 package       installed available remote
 curl          1.2       2.2       CRAN  
 evaluate      0.9       0.10      CRAN  
 gmailr        NA        0.7.1     CRAN  
 hunspell      NA        2.1       CRAN  
 irlba         2.1.1     2.1.2     CRAN  
 openssl       0.9.4     0.9.5     CRAN  
 R6            2.1.3     2.2.0     CRAN  
 rmarkdown     1.0       1.1       CRAN  
 stringi       1.1.1     1.1.2     CRAN 

This is potentially a little misleading because (?package_deps)

A ‘print()’ method identifies mismatches (if any) between local and CRAN versions of each dependent package;

that means that to get the full list of dependencies you need to print p$package directly:

p$package
 [1] "assertthat"    "base64enc"     "BH"            "BiocInstaller"
 [5] "bitops"        "brew"          "caTools"       "colorspace"   
 [9] "covr"          "crayon"        "curl"          "devtools"     
[13] "dichromat"     "digest"        "doParallel"    "evaluate"     
[17] "foreach"       "formatR"       "ggplot2"       "git2r"        
[21] "gmailr"        "gridBase"      "gtable"        "highr"        
[25] "htmltools"     "httr"          "hunspell"      "igraph"       
[29] "irlba"         "iterators"     "jsonlite"      "knitr"        
[33] "labeling"      "lazyeval"      "lintr"         "magrittr"     
[37] "markdown"      "memoise"       "mime"          "munsell"      
[41] "NMF"           "openssl"       "pkgmaker"      "plyr"         
[45] "praise"        "R6"            "RColorBrewer"  "Rcpp"         
[49] "registry"      "reshape2"      "rex"           "rmarkdown"    
[53] "rngtools"      "roxygen2"      "rstudioapi"    "rversions"    
[57] "scales"        "stringdist"    "stringi"       "stringr"      
[61] "testthat"      "tibble"        "whisker"       "withr"        
[65] "xml2"          "xtable"        "yaml"      
0
votes

Without an internet connection you'll need to have your IT Manager download the dependency packages as well, and install them in an appropriate order. When you pass repos = NULL to the install.packages function, it has nowhere to look for those dependencies.

Since each of those dependencies may have dependencies of their own*, that will probably end up being a major pain in your IT Manager's arse (yep, I'm in Australia too!). May I suggest you arrange for a temporary connection to the internet on your machine? Otherwise, maybe have a look at Packrat, which should (I haven't used it myself before) allow your IT Manager to create a project with the packages you need (including their dependencies) embedded within it. Then you can use that to install the packages on your machine.

  • for example, the package httr on which devtools depends, itself depends on mime, curl, openssl, and R6... mime then goes on to depend on tools... And down the rabbit hole we go...