Icudt Error While Installing Stringi Package from R in Linux Offline

icudt error while installing stringi package from r in linux offline

I was exactly in the same case and just got finally done installing that package.
I went to https://cran.r-project.org/web/packages/stringi/INSTALL and scrolled a little bit to find an answer. I'm quoting :

"If you have absolutely no internet access on the machines
you try to install stringi on, try fetching the latest development version
of the package. It already includes the ICU data archives.
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."

For the wget part, i just had to download directly from the link and send it to my server and then i got straight to the unzip-ing :)

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

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.

R install package stringi in renv

From ?renv::install:

Package Configuration:

Many R packages have a 'configure' script that needs to be run to
prepare the package for installation. Arguments and environment
variables can be passed through to those scripts in a manner
similar to install.packages. In particular, the R options
'configure.args' and 'configure.vars' can be used to map package
names to their appropriate configuration. For example:

# installation of RNetCDF may require us to set include paths for netcdf
configure.args = c(RNetCDF = "--with-netcdf-include=/usr/include/udunits2"))
options(configure.args = configure.args)
renv::install("RNetCDF")

Similarly, additional flags that should be passed to R CMD INSTALL
can be set via the 'install.opts' R option:

# installation of R packages using the Windows Subsystem for Linux
# may require the `--no-lock` flag to be set during install
options(install.opts = "--no-lock")
renv::install("xml2")

Setting something like:

options(configure.vars = list(stringi = "ICUDT_DIR=path/to/icudt61l.zip"))

should hopefully get you unstuck.

How to install stringi library from archive and install the local icu52l.zip


Note: for Stringi >= 0.5-1 please check the answer by @gagolews


From INSTALL file:

The stringi package depends on the ICU4C >= 50 library.

So libicu42 is far to old.

If you check install.R file you'll find following lines:

mirrors <- c("http://static.rexamine.com/packages/",
"http://www.mini.pw.edu.pl/~gagolews/stringi/",
"http://www.ibspan.waw.pl/~gagolews/stringi/")

A couple of lines later you'll find something like this:

if (!grepl("^https?://", href)) {
# try to copy icudt from a local repo
if (!file.exists(href)) return("no icudt in a local repo")

If you add local path at the beginning of the mirrors and put downloaded libraries it seems to work as expected. Here you can a patch I've used:
https://gist.github.com/zero323/338c8fb0faf46e5ac06d

So my solution would be to:

  • clone the repostiory
  • checkout version you want
  • apply patch with a path to the local version of the ICU
  • install package from source

There is probably a better way, but that is what I came up so far.



Related Topics



Leave a reply



Submit