Reputation: 2505
I am trying to install the package stringi with renv::install()
.
Normally, I would use
install.packages('stringi', configure.vars='ICUDT_DIR=path/to/icudt61l.zip/')
To specify the location of icudt61l.zip dependency. How can I do this in renv ?
I tried to add ICUDT_DIR='path/to/icudt61l.zip/'
in my .Rprofile but it didn't work.
Any idea how to tell renv where is ICU to install stringi ?
Here is the error I get
> renv::install("stringi")
...
Installing stringi [1.6.2] ...
FAILED
Error installing package 'stringi':
===================================
...
** package ‘stringi’ successfully unpacked and MD5 sums checked
** using staged installation
checking for R_HOME... /opt/R/4.0.3/lib/R
checking for R... /opt/R/4.0.3/lib/R/bin/R
...
checking with pkg-config for the system ICU4C... 50.1.2
checking for ICU4C >= 55... no
*** ICU4C 50.1.2 has been detected
*** Minimal requirements, i.e., ICU4C >= 55, are not met
*** Trying with 'standard' fallback flags
checking whether an ICU4C-based project can be built... yes
checking programmatically for sufficient U_ICU_VERSION_MAJOR_NUM... no
*** This version of ICU4C cannot be used.
*** Using the ICU 69 bundle.
checking whether we may compile src/icu69/common/putil.cpp... yes
checking whether we may compile src/icu69/i18n/number_affixutils.cpp... yes
checking whether alignof(std::max_align_t) is available... no
checking whether alignof(::max_align_t) is available... yes
checking whether the ICU data library can be downloaded... downloading the ICU data library (icudt)
output path: icu69/data/icu4c-69_1-data-bin-l.zip
trying URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
trying URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
icudt download failed
Error: Stopping on error
In addition: Warning messages:
1: In download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb") :
URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip': status was 'Couldn't connect to server'
2: In download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb") :
URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip': status was 'Couldn't connect to server'
Execution halted
*** *********************************************************************
*** stringi cannot be built.
*** Failed to download the ICU data library (icudt). Stopping now.
*** For build environments that have no internet access,
*** see the INSTALL file for a workaround.
*** *********************************************************************
ERROR: configuration failed for package ‘stringi’
* removing ‘/var/projects/iml/GDCFA21N/avertie_test/renv/staging/2/stringi’
Error: install of package 'stringi' failed [error code 1]
Upvotes: 4
Views: 1945
Reputation: 31
install.packages("stringi", configure.vars="ICUDT_DIR=<icudt_dir>")
just use this command, can be load ICUDT from local. if you run this all have ERROR,in icudt cannot connect.You should follow this https://raw.githubusercontent.com/gagolews/stringi/master/INSTALL.
Note that if you choose to use our ICU4C bundle, then -- by default -- the
ICU data library will be downloaded from one of our mirror servers.
However, if you have already downloaded a version of icudt*.zip
suitable
for your platform (big/little endian), you may wish to install the
package by calling:
install.packages("stringi", configure.vars="ICUDT_DIR=<icudt_dir>")
Moreover, if you have no internet access on the machines
you try to install stringi on, try fetching the latest development version
of the package, as it is shipped with 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 of the package is numbered x.y.z,
a file named stringi_x.y.z.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_x.y.z.tar.gz
Alternatively, call from within an R session:
install.packages("stringi_x.y.z.tar.gz", repos=NULL)
Upvotes: 3
Reputation: 21315
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.
Upvotes: 1