Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing a package offline from GitHub

Tags:

I'm trying to port some packages to an R installation on an offline (Windows) computer.

From CRAN (let's say data.table), the process: 1) download .zip on separate online computer 2) thumb drive -> offline computer 3) install via install.packages("....zip"...) works exactly as expected.

However, this process broke down when I tried to install from GitHub.

When I run install.packages (note: I'm using type="binary" and repos=NULL; type="win.binary" does nothing either) on the zip file (obtained by going to the package page, e.g. https://github.com/Rdatatable/data.table, and using the "Download .zip" function), something goes wrong.

There's no error message (and nothing new from setting verbose=TRUE), and the package folder is added to my library (i.e., I can see the folder named "data.table-master" when I navigate there), but library(data.table) results in the error: "there is no package called data.table". I also noticed that, while the installation from CRAN finishes with "package data.table successfully unpacked and MD5 sums checked", I get no such message from an attempted GitHub installation.

What's going on here? I tried all possible leads in ?install.packages, but given I'm not really getting an error message it's been hard to diagnose what exactly is the issue.

More background: R version is 3.2.0. Hard to copy-paste sessionInfo since that computer's not online, not sure what else may be relevant.

Update:

Given @r2evans' comments below, I also tried using type="source" with install.packages, and this didn't work either (same problem--despite having "data.table-master" folder in one of my .libPaths() addresses, library(data.table) gives the error that there's no such package).

I did get some more output from using verbose=TRUE this time, however:

system (cmd0): C:/PROGRA~1/R/R-32~1.0/bin/x64/R CMD INSTALL

1): succeeded 'C:/PROGRA~1/R/R-32~1.0/bin/x64/R CMD INSTALL -l "C:\Users\Mike\Documents\R\win-library\3.2" "E:/data.table-master.zip"'

like image 864
MichaelChirico Avatar asked Oct 16 '15 20:10

MichaelChirico


People also ask

How do I install an offline package?

You should be able to download all the modules that are in the directory /path/to/package/. Save this answer. Show activity on this post. Download the tarball, transfer it to your FreeBSD machine and extract it, afterwards run python setup.py install and you're done!

How do I manually install a package in R?

Go into R, click on Packages (at the top of the R console), then click on "Install package(s) from local zip files", then find the zip file with arm from wherever you just saved it. Do the same thing to install each of the other packages you want to install.


2 Answers

Let's assume that you have Rtools and devtools on the win machine.

Step 1: Download the source zip.

Step 2: Copy to the win machine and unzip the content there.

Step 3: Run the following code (adjust the path as necessary):

library(devtools) source <- devtools:::source_pkg("E:/temp/data.table-master") install(source)  library(data.table) #loads 1.9.7 
like image 195
Roland Avatar answered Sep 21 '22 13:09

Roland


You can use install_local from devtools to install a Github package with the zip you've downloaded, e.g. :

library("devtools") install_local(path = "data.table-master.zip") 

But you'll have to install all dependancies first.

like image 28
Victorp Avatar answered Sep 22 '22 13:09

Victorp