安装软件包错误,退出状态为非零,未找到软件包

时间:2020-09-22 11:19:57

标签: r

我只想安装软件包“ questionr”。但是以下错误不断发生。无法加载原本应该安装的程序包(库(程序包)),也无法在文件夹3.5中找到该程序包。以前从未遇到过这个问题。

你知道这是怎么回事吗?多谢您的协助!谢谢

   install.packages("questionr")


   Installing package into ‘C:/Users/bisc048/Documents/R/win-library/3.5’
   (as ‘lib’ is unspecified)
   also installing the dependencies ‘rlang’, ‘vctrs’, ‘haven’, ‘labelled’


   There are binary versions available but the source versions are later:
   binary source needs_compilation
   rlang      0.4.5  0.4.7              TRUE
   vctrs      0.2.4  0.3.4              TRUE
   haven      2.2.0  2.3.1              TRUE
   labelled   2.2.2  2.7.0             FALSE
   questionr  0.7.0  0.7.2             FALSE

   Binaries will be installed
   Warning in install.packages :
   packages ‘rlang’, ‘vctrs’ are in use and will not be installed
   trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/haven_2.2.0.zip'
   Content type 'application/zip' length 1050152 bytes (1.0 MB)
   downloaded 1.0 MB

   package ‘haven’ successfully unpacked and MD5 sums checked

   The downloaded binary packages are in
   C:\Users\bisc048\AppData\Local\Temp\RtmpUx6QYp\downloaded_packages
   installing the source packages ‘labelled’, ‘questionr’

   trying URL 'https://cran.rstudio.com/src/contrib/labelled_2.7.0.tar.gz'
   Content type 'application/x-gzip' length 194703 bytes (190 KB)
   downloaded 190 KB

   trying URL 'https://cran.rstudio.com/src/contrib/questionr_0.7.2.tar.gz'
   Content type 'application/x-gzip' length 1725961 bytes (1.6 MB)
   downloaded 1.6 MB

   * installing *source* package 'labelled' ...
   ** Paket 'labelled' erfolgreich entpackt und MD5 Summen überprüft
   ** R
   ** inst
   ** byte-compile and prepare package for lazy loading
   Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = 
   vI[[j]]) : 
   namespace 'haven' 2.2.0 is being loaded, but >= 2.3.1 is required
   ERROR: lazy loading failed for package 'labelled'
   * removing 'C:/Users/bisc048/Documents/R/win-library/3.5/labelled'
   In R CMD INSTALL
   Warning in install.packages :
   installation of package ‘labelled’ had non-zero exit status
   ERROR: dependency 'labelled' is not available for package 'questionr'
   * removing 'C:/Users/bisc048/Documents/R/win-library/3.5/questionr'
   In R CMD INSTALL
   Warning in install.packages :
   installation of package ‘questionr’ had non-zero exit status

   The downloaded source packages are in
   ‘C:\Users\bisc048\AppData\Local\Temp\RtmpUx6QYp\downloaded_packages’

   library(questionr)
   Error in library(questionr) : es gibt kein Paket namens ‘questionr’

1 个答案:

答案 0 :(得分:1)

似乎questionr无法安装,因为它依赖于labelled,因为依赖于haven的2.3.1或更高版本(取决于{{ 1}}和rlang,因为它们正在使用中而无法更新。

在不加载任何软件包的情况下开始全新的R会话。使用vctrs手动更新install.packages()rlang。然后手动更新vctrs。然后,手动安装haven。最后,尝试再次安装labbelled

如果您仍然无法更新questionr,请浏览至库文件夹并删除haven文件夹并重新安装。

看起来您仍在使用R 3.5。当前的R版本是4.0.2。更新R可能会有所帮助,尤其是在某些未能安装的依赖项需要比您使用的R更新版本的情况下。