R包出现namespace ‘XXXX’ 1.2-18 is already loaded, but >= 1.4.2 is required及其解决方案

2023-03-21 17:27:27 浏览数 (2)

a

安装R包出现下面的错误:

代码语言:javascript复制
installing to /opt/R/R-4.0.2/lib64/R/library/00LOCK-rms/00new/rms/libs
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace ‘Matrix’ 1.2-18 is already loaded, but >= 1.4.2 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Execution halted

报错信息是大致是说在安装或使用某个R包时,它的依赖包dplyr不能正常使用,原因是版本过低.

更新版本后安装:

代码语言:javascript复制
#rms
  #namespace ‘Matrix’ 1.2-18 is already loaded, but >= 1.4.2 is required
package_url="https://cran.r-project.org/src/contrib/Archive/Matrix/Matrix_1.5-0.tar.gz"
install.packages(package_url, repos = NULL, type = 'source')
install.packages('rms', ask=F, update=F)

0 人点赞