R 在 renv 中安装包 stringi
R install package stringi in renv
我正在尝试使用 renv::install()
.
安装包 stringi
通常我会用
install.packages('stringi', configure.vars='ICUDT_DIR=path/to/icudt61l.zip/')
指定icudt61l.zip依赖的位置。
我如何在 renv 中执行此操作?
我尝试在我的 .Rprofile 中添加 ICUDT_DIR='path/to/icudt61l.zip/'
,但没有成功。
知道如何告诉 renv ICU 在哪里安装 stringi 吗?
这是我得到的错误
> 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]
来自?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")
设置如下:
options(configure.vars = list(stringi = "ICUDT_DIR=path/to/icudt61l.zip"))
应该能让你摆脱困境。
install.packages("stringi", configure.vars="ICUDT_DIR=<icudt_dir>")
只需要使用这个命令,就可以从本地加载ICUDT。
如果你运行这一切都有错误,在icudt中不能connect.You应该遵循这个https://raw.githubusercontent.com/gagolews/stringi/master/INSTALL。
像这样关注:
ICU 数据库和无法访问互联网
请注意,如果您选择使用我们的 ICU4C 捆绑包,那么 - 默认情况下 -
ICU 数据库将从我们的镜像服务器之一下载。
但是,如果您已经下载了 icudt*.zip
合适的版本
对于您的平台(big/little endian),您可能希望安装
通过调用打包:
install.packages("stringi", configure.vars="ICUDT_DIR=<icudt_dir>")
此外,如果您的计算机无法访问互联网
您尝试安装 stringi,尝试获取最新的开发版本
包的,因为它与 ICU
数据档案一起运送。
您可以构建一个可分发的源包,其中包含所有必需的
ICU 数据文件(供离线使用)通过省略一些相关行
.Rbuildignore
文件。以下命令序列应该可以解决问题:
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
假设软件包的最新开发版本编号为x.y.z,
在当前工作目录中创建了一个名为 stringi_x.y.z.tar.gz
的文件。
现在可以安装包(源包可以通过
scp
等)通过执行:
R CMD INSTALL stringi_x.y.z.tar.gz
或者,从 R 会话中调用:
install.packages("stringi_x.y.z.tar.gz", repos=NULL)
我正在尝试使用 renv::install()
.
通常我会用
install.packages('stringi', configure.vars='ICUDT_DIR=path/to/icudt61l.zip/')
指定icudt61l.zip依赖的位置。 我如何在 renv 中执行此操作?
我尝试在我的 .Rprofile 中添加 ICUDT_DIR='path/to/icudt61l.zip/'
,但没有成功。
知道如何告诉 renv ICU 在哪里安装 stringi 吗?
这是我得到的错误
> 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]
来自?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")
设置如下:
options(configure.vars = list(stringi = "ICUDT_DIR=path/to/icudt61l.zip"))
应该能让你摆脱困境。
install.packages("stringi", configure.vars="ICUDT_DIR=<icudt_dir>")
只需要使用这个命令,就可以从本地加载ICUDT。 如果你运行这一切都有错误,在icudt中不能connect.You应该遵循这个https://raw.githubusercontent.com/gagolews/stringi/master/INSTALL。
像这样关注:
ICU 数据库和无法访问互联网
请注意,如果您选择使用我们的 ICU4C 捆绑包,那么 - 默认情况下 -
ICU 数据库将从我们的镜像服务器之一下载。
但是,如果您已经下载了 icudt*.zip
合适的版本
对于您的平台(big/little endian),您可能希望安装
通过调用打包:
install.packages("stringi", configure.vars="ICUDT_DIR=<icudt_dir>")
此外,如果您的计算机无法访问互联网
您尝试安装 stringi,尝试获取最新的开发版本
包的,因为它与 ICU
数据档案一起运送。
您可以构建一个可分发的源包,其中包含所有必需的
ICU 数据文件(供离线使用)通过省略一些相关行
.Rbuildignore
文件。以下命令序列应该可以解决问题:
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
假设软件包的最新开发版本编号为x.y.z,
在当前工作目录中创建了一个名为 stringi_x.y.z.tar.gz
的文件。
现在可以安装包(源包可以通过
scp
等)通过执行:
R CMD INSTALL stringi_x.y.z.tar.gz
或者,从 R 会话中调用:
install.packages("stringi_x.y.z.tar.gz", repos=NULL)