首页 > 解决方案 > 无法重新安装或运行 Stringr 包

问题描述

我最近将 ubuntu 从 18.04 升级到 20.04,所以这可能是相关的......

我的代码要求我拥有 stringr 包并使用 tidyverse。当我尝试运行require(stringr)library(tidyverse)收到这些错误时,

> require(stringr) # String manipulation
Loading required package: stringr
Error: package or namespace load failed for ‘stringr’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/elrodlab/R/x86_64-pc-linux-gnu-library/3.6/stringi/libs/stringi.so':
  libicui18n.so.60: cannot open shared object file: No such file or directory
> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/elrodlab/R/x86_64-pc-linux-gnu-library/3.6/stringi/libs/stringi.so':
  libicui18n.so.60: cannot open shared object file: No such file or directory

我尝试使用重新安装 stringrinstall.packages("stringr")但随后得到

Installing package into ‘/home/elrodlab/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/stringr_1.4.0.tar.gz'
Content type 'application/x-gzip' length 135777 bytes (132 KB)
==================================================
downloaded 132 KB

* installing *source* package ‘stringr’ ...
** package ‘stringr’ successfully unpacked and MD5 sums checked
mv: cannot move '/home/elrodlab/R/x86_64-pc-linux-gnu-library/3.6/stringr' to '/home/elrodlab/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-stringr/stringr': Permission denied
ERROR: cannot remove earlier installation, is it in use?
* removing ‘/home/elrodlab/R/x86_64-pc-linux-gnu-library/3.6/stringr’
Warning in install.packages :
  installation of package ‘stringr’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmptRvgMm/downloaded_packages’

尽管似乎 Stringr 很好用,但当我尝试使用时,require(stringr)我最终得到了这个错误

Loading required package: stringr Error: package or namespace load failed for ‘stringr’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/home/elrodlab/R/x86_64-pc-linux-gnu-library/3.6/stringi/libs/stringi.so': libicui18n.so.60: cannot open shared object file: No such file or directory

关于如何处理这个的任何想法?

标签: rubuntustringrfailed-installation

解决方案


第二条消息似乎表明stringr实际上已成功安装。再次尝试运行

require(stringr)

推荐阅读