安装R 包 stringr, stringi 报错及解决方法

Posted shuaihe

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装R 包 stringr, stringi 报错及解决方法相关的知识,希望对你有一定的参考价值。

加载或者安装R包 stringr,stringr时报错如下 libicui18n.so.64 找不到

加载:

library(stringi)
Error: package or namespace load failed for ‘stringi’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object ‘/data/home/heshuai/Miniconda3/envs/RV_3.6/lib/R/library/stringi/libs/stringi.so‘:
libicui18n.so.58: cannot open shared object file: No such file or directory

安装:

byte-compile and prepare package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object ‘/data/home/heshuai/Miniconda3/envs/RV_3.6/lib/R/library/stringi/libs/stringi.so‘:
  libicui18n.so.58: cannot open shared object file: No such file or directory
* installing *source* package ‘stringr’ ...
** package ‘stringr’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object ‘/data/home/heshuai/Miniconda3/envs/RV_3.6/lib/R/library/stringi/libs/stringi.so‘:
  libicui18n.so.58: cannot open shared object file: No such file or directory
Calls: <Anonymous> ... namespaceImport -> loadNamespace -> library.dynam -> dyn.load
Execution halted
ERROR: lazy loading failed for package ‘stringr’
* removing ‘/data/home/heshuai/Miniconda3/envs/RV_3.6/lib/R/library/stringr’
* restoring previous ‘/data/home/heshuai/Miniconda3/envs/RV_3.6/lib/R/library/stringr’

The downloaded source packages are in
	‘/tmp/RtmpxFZBJi/downloaded_packages’
Updating html index of packages in ‘.Library‘
Making ‘packages.html‘ ... done
Warning message:
In install.packages("stringr") :
  installation of package ‘stringr’ had non-zero exit status

找了好久才发现是不能使用默认的ICU库:解决方法如下:

install.packages("stringr", configure.args="--disable-pkg-config")

 

* installing *source* package ‘stringr’ ...
** package ‘stringr’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (stringr)

The downloaded source packages are in
	‘/tmp/RtmpT9D38H/downloaded_packages’
Updating HTML index of packages in ‘.Library‘
Making ‘packages.html‘ ... done

完美解决

 

 

参考:https://github.com/gagolews/stringi/blob/master/INSTALL; https://github.com/tidyverse/stringr/issues/320

 

以上是关于安装R 包 stringr, stringi 报错及解决方法的主要内容,如果未能解决你的问题,请参考以下文章

R----stringr包介绍学习

R语言学习14-stringr包

R语言stringr包str_dup函数字符串多次复制实战

R语言stringr包str_extract函数检查数据是否包含特定模式实战

R语言stringr包str_count函数计算字符串匹配个数实战

R语言stringr包str_detect函数检测字符串中模式存在与否实战