How to install stringi from local file (ABSOLUTELY no Internet Access)
Asked Answered
H

5

20

I am working on a remote server using RStudio. This server has no access to the Internet. I would like to install the package "stringi." I have looked at this stackoverflow article, but whenever I use the command

install.packages("stringi_0.5-5.tar.gz", 
                 configure.vars="ICUDT_DIR=/my/directory/for/icudt.zip")

It simply tries to access the Internet, which it cannot do. Up until now I have been using Tools -> Install Packages -> Install from Packaged Archive File. However, due to this error, I can no longer use this method.

How can I install this package?

Hemicellulose answered 11/8, 2015 at 12:50 Comment(4)
do you have devtools installed?Longhand
Which OS is the server running with? Have you tried setting repos = NULL and type = "source" explicitly?Quasi
I am on Linux. When I set repos = NULL and type = "source" it gives me the error icudt could not be downloaded. check your internet connectivity. Higher up, it says unable to resolve 'www.ibspan.waw.pl'Hemicellulose
I'd like to use this patch gist.github.com/zero323/338c8fb0faf46e5ac06d, but I don't know how. That way i could tell it to look in my local directory for the icudt.zip file, but I don't know how.Hemicellulose
B
21

If you have no internet access on local machines, you can build a distributable source package that includes all the required ICU data files (for off-line use) by omitting some relevant lines in the .Rbuildignore file. The following command sequence should do the trick:

wget https://github.com/gagolews/stringi/archive/master.zip -O stringi.zip
unzip stringi.zip
sed -i '/\/icu..\/data/d' stringi-master/.Rbuildignore
R CMD build stringi-master

Assuming the most recent development version is 1.3.1, a file named stringi_1.3.1.tar.gz is created in the current working directory. The package can now be installed (the source bundle may be propagated via scp etc.) by executing:

R CMD INSTALL stringi_1.3.1.tar.gz

or by calling install.packages("stringi_1.3.1.tar.gz", repos=NULL), from within an R session.

Braun answered 11/8, 2015 at 14:20 Comment(6)
Do you mean R CMD INSTALL stringi-master? (e.g as above but not with the .zip extension)Hemicellulose
@DazedandConfused Thanks!Braun
Do you mean unzip master.zip? Seems the zip is just downloaded with just master.zip name.Velate
@Braun wdyt about answer provided by SeungCheol Han? looks more neatAbroach
When I run sed -i '/\/icu..\/data/d' stringi-master/.Rbuildignore on OSX Catalina I get the following error: sed: 1: "stringi-master/.Rbuildi ...": unterminated substitute in regular expression.Galliard
@Galliard On MacOS use sed -i '' '/\/icu..\/data/d' stringi-master/.Rbuildignore (see stackoverflow.com/a/28592391)Stiffler
B
8

For a Linux machine the easiest way is from my point of view:

  1. Download the release you need from Rexamine in tar.gz format to your local pc. In opposition to the version on CRAN it already contains the icu55\data\ folder.
  2. Move the archive to your target linux machine without internet access
  3. run R CMD INSTALL stringi-1.0-1.tar.gz (in case of release 1.0-1)
Blazonry answered 4/2, 2016 at 9:54 Comment(2)
Confirming steps above worked perfectly in June 2021, on Redhat 7.9. Thankyou for sharing this!Bensen
@Bensen always surprised how long such things last ;)Blazonry
T
6

You provided the wrong value of configure.vars. It indicates that you have to give the directory's name, not a final file name.

Correct your code to the following:

install.packages("stringi_0.5-5.tar.gz", 
                 configure.vars="ICUDT_DIR=/my/directory/for/")

Regards, Sean

Tachometer answered 11/3, 2016 at 7:30 Comment(0)
L
1

Follow the steps below

  1. Download icudt55l.zip seperately from server where you have internet access with wget http://www.mini.pw.edu.pl/~gagolews/stringi/icudt55l.zip
  2. Copy the downloaded packages to the server where you want to install stringi
  3. Execute the following command R CMD INSTALL --configure-vars='ICUDT_DIR=/tmp/ALL' stringi_1.1.6.tar.gz

icudt55l.zip is copied to /tmp/ALL

Leclaire answered 8/3, 2018 at 14:7 Comment(0)
C
0

The suggestion from @gagolews almost worked for me. Here's what actually did the trick with RStudio.

  1. Download the master.zip file that will save as stringi-master.zip.
  2. Unzip the file onto your desktop. The unzipped folder should be stringi-master.
  3. Edit the .Rbuildignore file by removing ^src/icu55/data and ^src/icu61/data or similar lines.
  4. Move the folder from your desktop to the home directory of your server.
  5. Create a New Project in RStudio with ~/stringi-master as the Existing Directory
  6. From RStudio's menu, select Build and Build Source Package. (You may need to first select Configure Build Tools. For Project build tools choose Package then select OK.)
  7. It should create a tar.gz file, in the following format: stringi_x.x.(x+1).tar.gz. For example, if the current version of stringi is 1.5.3, it will create version 1.5.4. (I received a few warnings that didn't seem to affect the outcome.)
  8. Move the newly created package to your local repository. Update the repository index. And install the package.
Culmiferous answered 22/4, 2021 at 14:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.