简体   繁体   English

Package R 4.0.0之前安装了'XXX':请重新安装

[英]Package ‘XXX’ was installed before R 4.0.0: please re-install it

I am using R 4.0.2.我正在使用 R 4.0.2。

I manually installed 2 packages from cfcdae and Stats5303lib from here .我从这里手动安装了来自cfcdaeStats5303lib的 2 个包。 I followed the instruction here to download Rtools and use it to install packages above.我按照此处的说明下载了 Rtools 并使用它来安装上面的软件包。

Problem is问题是

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron") # runs fine
Sys.which("make") #works fine
                               make 
"C:\\rtools40\\usr\\bin\\make.exe" 
install.packages("Stat5303libs_0.7-5.zip",repos=NULL,type="source") # these all run fine
install.packages("cfcdae_0.8-4.zip",repos=NULL,type="source")  # these all run fine

However, when I ran into problem below when I tried to run the libraries.但是,当我尝试运行这些库时遇到以下问题。

Error: package or namespace load failed for ‘cfcdae’:
 package ‘cfcdae’ was installed before R 4.0.0: please re-install it

I tried below but still in vain.我在下面尝试但仍然徒劳无功。

update.packages(ask=FALSE, checkBuilt=TRUE)

Why is this happening?为什么会这样? Is it because the package is too old?是因为package太旧了吗?

Update:更新:

As requested, i have changed my .libPaths() as below and updated the SessionInfo() as well.根据要求,我已经如下更改了我的.libPaths()并更新了SessionInfo()

> .libPaths()
[1] "C:/Users/UserME/Documents/R/win-library/4.0"
[2] "C:/Program Files/R/R-4.0.2/library"   

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_Hong Kong SAR.1252  LC_CTYPE=English_Hong Kong SAR.1252   
[3] LC_MONETARY=English_Hong Kong SAR.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_Hong Kong SAR.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6        rstudioapi_0.11     magrittr_1.5       
 [4] splines_4.0.2       MASS_7.3-51.6       tidyselect_1.1.0   
 [7] munsell_0.5.0       statmod_1.4.34      lattice_0.20-41    
[10] colorspace_1.4-1    R6_2.4.1            rlang_0.4.6        
[13] minqa_1.2.4         dplyr_1.0.0         tools_4.0.2        
[16] grid_4.0.2          nlme_3.1-148        gtable_0.3.0       
[19] ellipsis_0.3.1      lme4_1.1-23         tibble_3.0.1       
[22] lifecycle_0.2.0     numDeriv_2016.8-1.1 crayon_1.3.4       
[25] Matrix_1.2-18       nloptr_1.2.2.2      purrr_0.3.4        
[28] ggplot2_3.3.2       vctrs_0.3.1         glue_1.4.1         
[31] compiler_4.0.2      pillar_1.4.6        generics_0.0.2     
[34] scales_1.1.1        boot_1.3-25         lmerTest_3.1-2     
[37] pkgconfig_2.0.3  

All packages need to be reinstalled under the new version (4.0).所有软件包都需要在新版本(4.0)下重新安装。 I had to first remove and then reinstall all the packages.我必须先删除然后重新安装所有软件包。

The following worked for me:以下对我有用:

# check your package library path 
.libPaths()

# grab old packages names
old_packages <- installed.packages(lib.loc = "/Library/Frameworks/R.framework/Versions/3.6/Resources/library")
old_packages <- as.data.frame(old_packages)
list.of.packages <- unlist(old_packages$Package)

# remove old packages 
remove.packages( installed.packages( priority = "NA" )[,1] )

# reinstall all packages 
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])]
if(length(new.packages)) install.packages(new.packages)
lapply(list.of.packages,function(x){library(x,character.only=TRUE)})

A zip file is a pre-built binary package for use on Windows, not a source package. zip 文件是用于 Windows 的预构建二进制package,而不是源 ZEFE90A8E604A67C840E8DZ8。 Installing it with install.packages(*, type="source") won't make a difference.install.packages(*, type="source")安装它不会有什么不同。 You'll need to contact the person/people who wrote these packages to build them again for R 4.0, or provide you with the real source -- this will usually be a .tar.gz file.您需要联系编写这些包的人/人,以便为 R 4.0 重新构建它们,或者为您提供真实的源——这通常是一个.tar.gz文件。

This issue is likely to happen when R is reading from an old directory, eg pre R 4.0.x.当 R 从旧目录读取时,可能会发生此问题,例如 R 4.0.x 之前的目录。

Here is a few possible ways to fix this:以下是解决此问题的几种可能方法:

  • Check your .libPaths() - R could be reading packages from a R 3.xx library, which would produce the error you are getting.检查您的.libPaths() - R 可能正在从 R 3.xx 库中读取包,这会产生您遇到的错误。 Alternatively, try creating a new library directory (this is very likely to fix the issue).或者,尝试创建一个新的库目录(这很可能会解决问题)。
  • update.packages(ask=FALSE, checkBuilt=TRUE) (which you have already tried) update.packages(ask=FALSE, checkBuilt=TRUE) (您已经尝试过)
  • Remove previous installations of R, and their associated directories.删除以前安装的 R 及其相关目录。

If you're having trouble with this issue while using renv , you may need to look at your renv cache .如果您在使用renv时遇到此问题,您可能需要查看您的renv缓存 I had to delete mine to force my projects to use newly-installed versions of packages instead of the old ones.我不得不删除我的以强制我的项目使用新安装的软件包版本而不是旧版本。

In a similar situation, I renamed 'site-library' to 'old-site-library', made a new empty 'site-library' folder and proceeded from there successfully.在类似的情况下,我将“site-library”重命名为“old-site-library”,创建了一个新的空“site-library”文件夹并从那里成功进行。

In case anyone runs into this error message when running revdepcheck::revdep_check() , what worked for me was deleting the /revdep/ folder in my R package's directory.万一有人在运行revdepcheck::revdep_check()时遇到此错误消息,对我有用的是删除我的 R 包目录中的/revdep/文件夹。

This code worked for me这段代码对我有用

  tmp = as.data.frame(installed.packages()) 
  max_version = max(as.numeric(substr(tmp$Built, 1,1)))
  tmp = tmp[as.numeric(substr(tmp$Built, 1,1)) < max_version,]
  lapply(tmp$Package, remove.packages)
  lapply(tmp$Package, function(x) install.packages(x, dependencies = TRUE))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 R 4.0.0 之前安装了包“xxx”:请重新安装(已经完成全新安装并检查了 lib 路径) - Package 'xxx’ was installed before R 4.0.0: please re-install it (already done fresh install and checked lib paths) R:“mxnet”的命名空间加载失败:package“mxnet”是在 R 4.0.0 之前安装的:请重新安装它 - R: namespace load failed for ‘mxnet’: package ‘mxnet’ was installed before R 4.0.0: please re-install it 错误:“ggplot2”的包或命名空间加载失败:包“ggplot2”是在 R 4.0.0 之前安装的:请重新安装执行停止 - Error: package or namespace load failed for 'ggplot2': package 'ggplot2' was installed before R 4.0.0: please re-install it Execution halted Package 'stringr' 在 R 4.0.0 之前安装:请重新安装 BiocManager 安装路径不可写,无法更新软件包 - Package ‘stringr’ was installed before R 4.0.0: please re-install it BiocManager Installation path not writeable, unable to update packages 失败并发生错误:R 3.0.0之前已构建“包&#39;sentiment&#39;:请重新安装” - Failed with error: ‘package ‘sentiment’ was built before R 3.0.0: please re-install it’ R中“错误:包&#39;_____&#39;是在3.0.0之前构建的:请重新安装”的原因 - Causes of “Error: package '_____' was built before 3.0.0: please re-install it” in R 错误:包&#39;dmGWAS&#39;是在R 3.0.0之前构建的:请重新安装它 - Error: package ‘dmGWAS’ was built before R 3.0.0: please re-install it 如何重新安装修改后的R程序包 - How to re-install a modified R package 错误 purr package or namespace loading failed for purr package was installed before r 4.0.0 - error purr package or namespace loading failed for purr package was installed before r 4.0.0 在CentOS 6.5中使用共享库选项重新安装R - Re-Install R with Shared library option in CentOS 6.5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM