在 Windows 上安装软件包 devtools 和 callr 时出现问题

Problems installing packages devtools and callr on Windows

正在安装包devtools我收到以下消息

There are binary versions available but the source versions are later:
         binary source needs_compilation
processx  3.3.1  3.4.0              TRUE
callr     3.2.0  3.3.0             FALSE

此外:

* installing *source* package 'callr' ...
** package 'callr' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = 
vI[[j]]) : 
namespace 'processx' 3.3.1 is being loaded, but >= 3.4.0 is required

ERROR: lazy loading failed for package 'callr'
* removing 'C:/Users/Standard/Documents/R/win-library/3.6/callr'
Warning in install.packages :
installation of package ‘callr’ had non-zero exit status

然后我尝试更新processx包,希望它能解决问题:

install.packages("processx")
library(processx)

RStudio 要求我重新启动 R 会话,但随后

> install.packages("devtools")
ERROR: lazy loading failed for package 'callr'
* removing 'C:/Users/Standard/Documents/R/win-library/3.6/callr'
Warning in install.packages :
installation of package ‘callr’ had non-zero exit status

我做错了什么?

编辑 我尝试以这种方式安装 processxcallr 及其依赖项

install.packages("processx", dependencies=TRUE)
library(processx)
install.packages("callr", dependencies=TRUE)
library(callr)

但我收到了消息:

Error in library(callr) : there is no package called ‘callr’

我有同样的问题。我认为你的问题是,需要安装最新的 Rtools 版本。安装 Rtools 后,Devtools 将正确安装,包括对 callr 和 processx 的依赖。所以请执行以下操作:

  1. 从您的 Rversion 文件夹下的库文件夹中删除 callr 和 processx 以及 devtools 包。
  2. 关闭 Rstudio 或 R shell。
  3. 从此站点下载推荐版本: https://cran.r-project.org/bin/windows/Rtools/ 按照此处的说明进行操作:http://jtleek.com/modules/01_DataScientistToolbox/02_10_rtools/#6
  4. 安装 rtools 和 devtools 后,检查 find_rtools() 是否为 TRUE

现在也应该安装 callr 和 processx,如您在库文件夹中所见。