gpt4 book ai didi

R 在 renv 中安装包 stringi

转载 作者:行者123 更新时间:2023-12-05 03:41:49 27 4
gpt4 key购买 nike

我正在尝试使用 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]

最佳答案

install.packages("stringi", configure.vars="ICUDT_DIR=<icudt_dir>")

只需要使用这个命令,就可以从本地加载ICUDT。如果你运行这一切都有错误,在 icudt 中无法连接。你应该按照这个 https://raw.githubusercontent.com/gagolews/stringi/master/INSTALL .

如下所示:

ICU 数据库和无法访问互联网

请注意,如果您选择使用我们的 ICU4C bundle ,那么 - 默认情况下 -ICU 数据库将从我们的镜像服务器之一下载。但是,如果您已经下载了适合的 icudt*.zip 版本对于您的平台(大/小端),您可能希望安装通过调用打包:

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 session 中调用:

install.packages("stringi_x.y.z.tar.gz", repos=NULL)

关于R 在 renv 中安装包 stringi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67590302/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com