【问题标题】:Cannot install packages: pillar, devtools. Cannot load: tidyverse, broom, etc无法安装软件包:pillar、devtools。无法加载:tidyverse、broom 等
【发布时间】:2021-07-06 16:42:12
【问题描述】:

我在虚拟桌面上加载和安装软件包时遇到问题。我在尝试打开 tidyverse 库和其他库时突然遇到以下错误:

> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 namespace ‘broom’ 0.5.6 is being loaded, but >= 0.7.6 is required

然后我尝试加载扫帚(已安装)并收到此错误:

> library(broom)
Error: package or namespace load failed for ‘broom’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘pillar’

然后我安装pillar并获取这些消息,但pillar实际上并没有下载。

> install.packages('pillar')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘\\norc.org/home/MD/Smith-Quincey/R/win-library/3.6’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
       binary source needs_compilation
pillar  1.6.0  1.6.1             FALSE

installing the source package ‘pillar’

trying URL 'https://cran.rstudio.com/src/contrib/pillar_1.6.1.tar.gz'
Content type 'application/x-gzip' length 1111747 bytes (1.1 MB)
downloaded 1.1 MB

'\\norc.org\home\MD\Smith-Quincey'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
* installing *source* package 'pillar' ...
** package 'pillar' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in findpack(package, lib.loc) : there is no package called 'pillar'
Calls: <Anonymous> -> findpack
Execution halted
ERROR: lazy loading failed for package 'pillar'
* removing '\\norc.org/home/MD/Smith-Quincey/R/win-library/3.6/pillar'
Warning in install.packages :
  installation of package ‘pillar’ had non-zero exit status

The downloaded source packages are in
    ‘C:\Users\smith-quincey\AppData\Local\Temp\54\Rtmpqs7eIH\downloaded_packages’

我在使用 devtools 时遇到了类似的问题。当我尝试安装它时,我收到以下消息:

> install.packages('devtools')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘\\norc.org/home/MD/Smith-Quincey/R/win-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependencies ‘remotes’, ‘rversions’


  There are binary versions available but the source versions are later:
          binary source needs_compilation
remotes    2.3.0  2.4.0             FALSE
rversions  2.0.2  2.1.1             FALSE
devtools   2.4.1  2.4.2             FALSE

installing the source packages ‘remotes’, ‘rversions’, ‘devtools’

trying URL 'https://cran.rstudio.com/src/contrib/remotes_2.4.0.tar.gz'
Content type 'application/x-gzip' length 149836 bytes (146 KB)
downloaded 146 KB

trying URL 'https://cran.rstudio.com/src/contrib/rversions_2.1.1.tar.gz'
Content type 'application/x-gzip' length 42064 bytes (41 KB)
downloaded 41 KB

trying URL 'https://cran.rstudio.com/src/contrib/devtools_2.4.2.tar.gz'
Content type 'application/x-gzip' length 371298 bytes (362 KB)
downloaded 362 KB

'\\norc.org\home\MD\Smith-Quincey'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
* installing *source* package 'remotes' ...
** package 'remotes' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in findpack(package, lib.loc) : 
  there is no package called 'remotes'
Calls: <Anonymous> -> findpack
Execution halted
ERROR: lazy loading failed for package 'remotes'
* removing '\\norc.org/home/MD/Smith-Quincey/R/win-library/3.6/remotes'
Warning in install.packages :
  installation of package ‘remotes’ had non-zero exit status
'\\norc.org\home\MD\Smith-Quincey'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
* installing *source* package 'rversions' ...
** package 'rversions' successfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading
Error in findpack(package, lib.loc) : 
  there is no package called 'rversions'
Calls: <Anonymous> -> findpack
Execution halted
ERROR: lazy loading failed for package 'rversions'
* removing '\\norc.org/home/MD/Smith-Quincey/R/win-library/3.6/rversions'
Warning in install.packages :
  installation of package ‘rversions’ had non-zero exit status
'\\norc.org\home\MD\Smith-Quincey'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
ERROR: dependencies 'remotes', 'rversions' are not available for package 'devtools'
* removing '\\norc.org/home/MD/Smith-Quincey/R/win-library/3.6/devtools'
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in
    ‘C:\Users\smith-quincey\AppData\Local\Temp\54\Rtmpqs7eIH\downloaded_packages’

如果您有任何指示,请告诉我。

谢谢!

【问题讨论】:

  • 您是否尝试过在 R 而不是 RStudio 中安装东西?只是一些容易检查的东西,通常是一种解决方法
  • 当您看到消息“正在加载**,但需要**”时,这意味着包的一部分已经加载到 R 工作区中,并且无法在该会话中更新。通常这意味着您需要退出 R 并重新启动。确保您没有在启动脚本中自动加载任何包。然后再次尝试install.packages()。当它询问您是否要从源代码安装时,请务必说“不”。这将安装更可能不会造成麻烦的预编译版本。你可以明确地使用install.packages(..., type="binary")
  • 要添加到@MrFlick 的评论中:当你重新启动 R 时,请确保你不在正在加载 .Rdata 文件的当前项目中(这与提到的“启动脚本”密切相关) ):这样做可以并且会加载一些包,这可能不允许您更新错误的包。如果是这种情况(并且您正在使用 RStudio),则在 RStudio 中启动一个新项目(没有 .Rdata 文件),重新启动 R,并尝试在 there 中安装这些包,而不是在已经依赖(并加载)这些包的项目。
  • @MrFlick ,非常感谢您的评论(还有 r2evans)。在新脚本中使用“type = “binary””选项解决了我的问题!再次感谢!

标签: r tidyverse devtools


【解决方案1】:

正如警告所说,您需要 Rtools 在 Windows 上从源代码安装包。要么先安装 Rtools https://cran.rstudio.com/bin/windows/Rtools/,要么在询问您是否要从源代码安装时说不。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-24
    • 1970-01-01
    • 2017-11-02
    • 2020-05-15
    • 2020-09-26
    • 2021-10-06
    • 2023-03-09
    相关资源
    最近更新 更多