Offline install of R package and dependencies

install r package from source with dependencies
manual install packages r
install packages r download
how to install r package by hand
install clustersim package in r
installing r packages without internet
how to manually download and install r packages
download r packages

Suppose I need to install a number of packages on a (Linux) machine that does not have an internet connection. Let's say that I downloaded a copy of cran and burned it on a DVD that I bring to the offline location:

wget ftp://cran.r-project.org/pub/R/src/contrib/*.tar.gz

I can even add a PACKAGES file that contains an overview of all the source packages and their dependencies:

library(tools)
write_PACKAGES()

How could I use this offline to install a source package in such a way that dependencies are resolved and installed from the local files as well? For example, someone wants to install package ggplot2, which has a fairly deep dependency structure. Assume the source package of ggplot2 and all of its dependencies are available as source packages in the current working directory. If I do:

install.packages("ggplot2_0.9.1.tar.gz", repos=NULL)

This results in an error, because the dependencies are not resolved at all. Alternatively:

install.packages(list.files(pattern="*.tar.gz"), repos=NULL)

However this also ignores the dependency structure, and tries to install packages in alphabetical order, which will also fail.

I looked into available.packages and contrib.url but I just can't find an example of installing a source package from a local file including it's dependencies.


The correct answer was given by Joshua Ulrich in the comment on the question:

The key is prefixing the argument to either repos or contriburl with file://. So in Unixy systems one could do:

install.packages("ggplot2", contriburl="file:///path/to/packages/")

This assumes that all required source packages, as well as a PACKAGES index file is available in /path/to/packages. If no PACKAGES file is present, this should be generated first using:

library(tools)
write_PACKAGES("/path/to/packages/")

which will generate an index of all source packages found in this directory. Note that in the example, there are 3 slashes behind the file: prefix. The third slash indicates a path relative to the root of the file system.

The difference between the repos and contriburl argument is that repos will append another /src/contrib to the path specified, as this is usually where source packages are located on an official CRAN repository mirror.

Installing Packages without Internet, Here's a short example script that uses package_dependencies() to figure out the dependencies from the packages we want to use. If you are using RStudio, you can install the package using the GUI. At the top, got to Tools and select Install Packages from the drop down. Start typing the package you want in the box, it will pop up in the window. Finally, make sure install dependencies and checked and click install.


With reference to Answer above, if installation is in Windows, then write_PACKAGES() generates two files: PACKAGES and PACKAGES.gz under '/path/to/packages/' directory where all zip files are placed. The file PACKAGES.gz should be deleted before install.packages() function is correctly able to read the lone PACKAGES file else 'cannot open compressed file' error appears.

Install R Package offline from local repo, I'll be installing the package called "tidyr". In order to fully install the package, I need to first download tidyr and all dependencies. To do this, I  Assuming you already downloaded the package before from another machine that has internet access and FTP the files to your server, you can use the following command to install a rpm. rpm -ivh package_name_x85_64.rpm options: i = This installs a new package. v = Print verbose information; h = Print 50 hash marks as the package archive is unpacked.


I had the same issues during offline installation. Somehow it didn't work by command line.

I downloaded, extracted all the dependencies (Keeping check of the min version required) and pasted the folders in the library folder. This way only my problem got solved.

Offline installation of packages - General, I install packages from local repository (zip files) using install.packages("​package_name", It takes about 10 minutes to install package with its dependencies. Is there any solution to martin.R November 8, 2018, 2:35pm #2. My institute uses proxy server, and no one is able to install packages in a usual way. (i.e downloading binary file from CRAN and then choosing Mirro and the installing etc etc). I am able to install packages if I use internet outside of my institute. So, I am looking for an offline way to install packages.


R: Install Packages from Repositories or Local Files, install.packages(pkgs, lib, repos = getOption("repos"), contriburl = contrib.url(​repos, type), method, available = NULL, destdir = NULL, dependencies = NA, type  Select the packages you want to install, and then in the file menu choose to generate a download script. Take that download script to the online PC and execute it.. Then copy the downloaded files over and try to use dpkg -i *.deb to get everything installed.


Effective way of installing R package dependencies : rstats, The first 2 was quite simple but i'm running into errors with the package install. Since a lot of R packages have dependencies, what's the best way to get a list of​  Offline use of RStudio Connect, however, requires admins to set up a package repository. This requirement is necessary to enable Connect to manage and isolate package dependencies for deployed content. In brief, Connect installs packages from the local repository into private libraries for each piece of deployed content.


R Installation and Administration - CRAN, 8 Choosing between 32- and 64-bit builds; 9 The standalone Rmath library Whether R CMD INSTALL (and hence install.packages ) pre-builds HTML pages (The Makefile doesn't enforce this dependency—some build targets force a lot of  Using repotrack to download rpm package and all dependencies. repotrack is a program for keeping track of a particular package and its dependencies. It will download one or more packages and all dependencies. Using the below command I am downloading glibc and all it’s dependencies using repotrack in it’s current directory