How to install TIdyverse without internet connection for R 3.5.2

Hi all

I am working in an environment without internet access. Hence, I have transferred TIdyverse-1.2.1.zip using thumb drive to my pc for installation. However, the following error popped out when i try to load TIdyverse after installation:

Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):

there is no package called ‘broom’

In addition: Warning message:

package ‘tidyverse’ was built under R version 3.6.1

Do anyone know how to resolve this? Thank you in advance.

PS: I can only use R 3.5.2

Hi, and welcome!

Packages, like tidyverse can depend on other packages. If those are not already installed, they are fetched from a CRAN repository and installed as part of the depending package installation.

The broom package is simply the first of many tidyverse dependencies

Imports: broom (>= 0.4.2), cli (>= 1.0.0), crayon (>= 1.3.4), dplyr (>=
0.7.4), dbplyr (>= 1.1.0), forcats (>= 0.2.0), ggplot2 (>=
2.2.1), haven (>= 1.1.0), hms (>= 0.3), httr (>= 1.3.1),
jsonlite (>= 1.5), lubridate (>= 1.7.1), magrittr (>= 1.5),
modelr (>= 0.1.1), purrr (>= 0.2.4), readr (>= 1.1.1), readxl
(>= 1.0.0), reprex (>= 0.1.1), rlang (>= 0.1.4), rstudioapi (>=
0.7), rvest (>= 0.3.2), stringr (>= 1.2.0), tibble (>= 1.3.4),
tidyr (>= 0.7.2), xml2 (>= 1.1.1)

A less hair pulling experience would be to use an online machine to download all your desired libraries to the default directory and then copy that via thumbdrive to your un-connected machine.

You'll need to get all the dependencies as @technocrat explained.

There are tools to help with that. For example, minicran :package:
https://cran.r-project.org/web/packages/miniCRAN/index.html

First, It will help you easily identify package dependencies, but also help you create a local subset of CRAN with the packages you need.

library("miniCRAN")
pkgDep("tidyverse")
#>  [1] "tidyverse"    "broom"        "cli"          "crayon"      
#>  [5] "dplyr"        "dbplyr"       "forcats"      "ggplot2"     
#>  [9] "haven"        "hms"          "httr"         "jsonlite"    
#> [13] "lubridate"    "magrittr"     "modelr"       "purrr"       
#> [17] "readr"        "readxl"       "reprex"       "rlang"       
#> [21] "rstudioapi"   "rvest"        "stringr"      "tibble"      
#> [25] "tidyr"        "xml2"         "backports"    "generics"    
#> [29] "nlme"         "reshape2"     "assertthat"   "DBI"         
#> [33] "glue"         "R6"           "tidyselect"   "pkgconfig"   
#> [37] "Rcpp"         "BH"           "plogr"        "ellipsis"    
#> [41] "digest"       "gtable"       "lazyeval"     "MASS"        
#> [45] "mgcv"         "scales"       "viridisLite"  "withr"       
#> [49] "vctrs"        "curl"         "mime"         "openssl"     
#> [53] "clipr"        "cellranger"   "progress"     "callr"       
#> [57] "fs"           "rmarkdown"    "whisker"      "selectr"     
#> [61] "stringi"      "fansi"        "pillar"       "lifecycle"   
#> [65] "processx"     "rematch"      "Matrix"       "lattice"     
#> [69] "askpass"      "utf8"         "prettyunits"  "plyr"        
#> [73] "knitr"        "yaml"         "htmltools"    "evaluate"    
#> [77] "base64enc"    "tinytex"      "xfun"         "labeling"    
#> [81] "munsell"      "RColorBrewer" "zeallot"      "sys"         
#> [85] "highr"        "markdown"     "colorspace"   "ps"          
#> [89] "feather"

There is 86 :package: you need to install it seems.

You can follow the advice from the vignette to create a local CRAN in a folder, download those :package: into it. Then after moving the whole folder into you offline server, you would configure install.packages to use you local CRAN on your file system.

install.packages(pkgs, 
                 repos = paste0("file:///", pth_to_local_cran),
                 type = "source") # win.bin for windows if you download them

https://cran.r-project.org/web/packages/miniCRAN/vignettes/miniCRAN-introduction.html

This is one way of achieving this.

You can also use some products to be CRAN mirrors for offline environment. Look at RStudio Package Manager - RStudio
hope it helps.

4 Likes

Hi all

Thank you for the advice.
I have installed all the packages, and the following error pop out instead:

Error: package or namespace load failed for ‘tidyverse’ in rbind(info, getNamespaceInfo(env, "S3methods")):
number of columns of matrices must match (see arg 2)
In addition: Warning message:
package ‘tidyverse’ was built under R version 3.6.1

I am unable to use tidyverse when i tried to load it. Is there anyway to resolve this?

So you need for that particular analysis all the tidverse?
You may have already installed what you need. I had once an error installing it. Long time, very expensive. In your circumstances I would go straight to what you need. Specific packages.
Extra dependencies can make a nightmare without internet...