0

I am trying to install some R packages. Unfortunately the machine does not have access to the internet and so I have to install them offline.
More specifically I am trying to install the stringi package (https://cran.r-project.org/web/packages/stringi/index.html). These are the steps I am following:

  1. Download the package (from a machine which has an internet connection) from https://cran.r-project.org/src/contrib/stringi_1.5.3.tar.gz

  2. Create a folder on the machine I have R to act as a repo

  3. Run this piece of code:

    library(tools)
    write_PACKAGES("./R_repo/")
    install.packages("stringi", contriburl="file:./R_repo")
    

The installation actually starts and passes all the checks. The probelm is that it breaks when, as part of the process, is trying to download additional files.
More specifically:

trying URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu61/data/icudt61l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL 
'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu61/data/icudt61l.zip'

trying URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu55/data/icudt61l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL     
'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu55/data/icudt61l.zip'

trying URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu61/data/icudt61l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL      
'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu61/data/icudt61l.zip'

trying URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu55/data/icudt61l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL 
'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu55/data/icudt61l.zip'

trying URL 'http://www.ibspan.waw.pl/~gagolews/stringi/icudt61l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL 
'http://www.ibspan.waw.pl/~gagolews/stringi/icudt61l.zip'

trying URL 'http://www.gagolewski.com/software/stringi/icudt61l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL 
'http://www.gagolewski.com/software/stringi/icudt61l.zip'

icudt download failed
Error: Stopping on error

Is there a way to download these additional files manually and saved them on the machine, so during the installation process it does not have to fetch them on the internet?

Thank you, Marco

Marco De Virgilis
  • 982
  • 1
  • 9
  • 29

1 Answers1

0

Do you not have Rstudio? under the top toolbar, there is a tools tab, if you click that drop down, you should get a install packages... options, this is where you can browse your files and find a .zip file that you have downloaded and moved to the PC from a USB flash drive. If you don't have Rstudio, might as well download the .EXE with the desired packages as well, its worth your time.

Daniel_j_iii
  • 3,041
  • 2
  • 11
  • 27
  • Hi I do not have rstudio and the machine I am talking about is a remote UNIX server in which I can ssh into it – Marco De Virgilis Oct 29 '20 at 15:25
  • is it AIX? you will need a different syntax `install.packages(list.files(pattern="*.tar.gz"), repos=NULL)` from with the same directory where the file is. you will need to do `getwd()` and go to where to the package file is. – Daniel_j_iii Oct 29 '20 at 15:34
  • It is Red Hat. So basically I should download the extra files and put them in the local repo? – Marco De Virgilis Oct 29 '20 at 15:36
  • The `install.packages("stringr"`) command is going to trigger the command to go to the internet. – Daniel_j_iii Oct 29 '20 at 15:37
  • I think the `.tar.gz` should already have everything you need, no? – Daniel_j_iii Oct 29 '20 at 15:37
  • That's the problem. The `.tar.gz` download from CRAN does not have the additional files required. During the installation it is trying to download them but it fails – Marco De Virgilis Oct 29 '20 at 15:39
  • from my experience, downloading the package to a source file has been fine, I have successfully installed packages from source, maybe download the file again? i understand this may not be possible. What error do you get when you run the `install.packages(list.files(pattern="*.tar.gz"), repos=NULL) from the respective directory?` – Daniel_j_iii Oct 29 '20 at 15:41
  • In this case it does not work. The `.tar.gz` does not contain everything it needs and therefore it is trying to download the additional files. The question is, since I cannot go online, is there a way to manually download the additional files required? – Marco De Virgilis Oct 29 '20 at 15:43
  • no, if you do not have internet, you can not get anything that does not reside outside of the local network. The package may rely on other packages/functions – Daniel_j_iii Oct 29 '20 at 15:46
  • So basically there is no way to download the additional files manually and save them on the machine so the process uses them rather then download them again? – Marco De Virgilis Oct 29 '20 at 15:48
  • `install.packages("stringi", dep = TRUE)`, if that doesn't work, then no. – Daniel_j_iii Oct 29 '20 at 15:52
  • It can actually be done. https://stackoverflow.com/questions/31942322/how-to-install-stringi-from-local-file-absolutely-no-internet-access – Marco De Virgilis Oct 29 '20 at 16:15
  • Good. we both learn something, so this solution worked for you? you used `install.packages("stringi_1.5.3.tar.gz", configure.vars="ICUDT_DIR=/my/directory/for/icudt.zip")` – Daniel_j_iii Oct 29 '20 at 16:20