简体   繁体   English

R 无法从 GitHub 安装软件包(系统错误 267 @win/processx.c:1040)

[英]R Unable to Install Packages From GitHub (System Error 267 @win/processx.c:1040)

TL;DR TL; 博士

Unable to install any package from GitHub, System Error 267无法从 GitHub 安装任何软件包,系统错误 267

I've newly setup R (v4.1), Rstudio and just installed devtools.我新安装了 R (v4.1)、Rstudio 并且刚刚安装了 devtools。 I also additionally installed Rtools40 and added it to my path (global environment)我还额外安装了Rtools40并将其添加到我的路径(全局环境)

Rtools seems to work properly as validated with: Sys.which("make") & maketools::rtools_find() (output below) Rtools 似乎可以正常工作,经验证: Sys.which("make") & maketools::rtools_find() (输出如下)

Problem问题

I am unable to install any package from GitHub, eg rstudio/gt .我无法从 GitHub 安装任何软件包,例如rstudio/gt The error is nearly identical for any GitHub Package, allways stating system error 267任何 GitHub 包的错误几乎相同,总是说明system error 267

devtools::install_github("rstudio/gt")
Downloading GitHub repo rstudio/gt@HEAD
Error: Failed to install 'gt' from GitHub:
  create process 'C:/PROGRA~1/R/R-41~1.0/bin/x64/Rcmd.exe' (system error 267, Der Verzeichnisname ist ungültig.
) @win/processx.c:1040 (processx_exec

Update更新

As suggested I reinstalled R 4.1.0 to the most simple folde possible C:/R/ The error ist still the same despite now lacking tildes ~按照建议,我将 R 4.1.0 重新安装到最简单的文件夹C:/R/尽管现在缺少波浪号,但错误仍然相同~

devtools::install_github("rstudio/gt")
Downloading GitHub repo rstudio/gt@HEAD
Error: Failed to install 'gt' from GitHub:
  create process 'C:/R/bin/x64/Rcmd.exe' (system error 267, Der Verzeichnisname ist ungültig.
) @win/processx.c:1040 (processx_exec)

Update 2:更新 2:

Changed the .libPaths to a folder without any special characters将 .libPaths 更改为没有任何特殊字符的文件夹

.libPaths( c( "D:/tmp" , .libPaths() ) )
.libPaths()
[1] "D:/tmp"                                     "C:/Users/Björn/Documents/R/win-library/4.1"
[3] "C:/R/library"  

Error is still the same

Update 3:更新 3:

I updated some packages, and checked the version of packageVersion('processx') = 3.5.2我更新了一些包,并检查了packageVersion('processx') = 3.5.2 的版本

install.packages("testthat") 
install.packages("pkgload") 
install.packages("devtools") 
install.packages("remote")

Content of Sys.getenv Sys.getenv 的内容

 Sys.getenv('Path')
[1] "C:\\rtools40\\usr\\bin;C:\\R\\bin\\x64;C:\\rtools40\\usr\\bin;C:\\rtools40\\mingw64\\bin;

Diagnostics诊断

Session Info会议信息

> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C                    LC_TIME=German_Germany.1252    

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

Rtools successful installed / setup Rtools 成功安装/设置

Sys.which("make")
                              make 
"C:\\rtools40\\usr\\bin\\make.exe" 

maketools::rtools_find()
$version
[1] ‘4.0’

$compiler
[1] "gcc 8.3.0"

$api
[1] ‘8’

$PATH
[1] "C:\\rtools40\\usr\\bin"

$BINPREF
[1] "C:/rtools40/mingw$(WIN)/bin/"

$available
[1] TRUE

$compatible
[1] TRUE   

The standalone mode of the remotes package solved the issue for me, as suggested by the maintainer of processx (Gábor Csárdi) here该遥控器包的单机模式解决了这个问题对我来说,通过维护者的建议processx (的GaborCsárdi)在这里

devtools::install_github() only calls remotes::install_github() . devtools::install_github()只调用remotes::install_github()
However, for the remotes, there is the option to be exectued in standalone mode但是,对于遥控器,可以选择在独立模式下执行

Source: Cran资料来源: 克兰

Standalone mode单机模式

remotes will use the curl, git2r and pkgbuild packages if they are installed to provide faster implementations for some aspects of the install process.如果安装了 curl、git2r 和 pkgbuild 包,远程将使用它们来为安装过程的某些方面提供更快的实现。 However if you are using remotes to install or update these packages (or their reverse dependencies) using them during installation may fail (particularly on Windows).但是,如果您使用遥控器安装或更新这些软件包(或其反向依赖项),则在安装期间使用它们可能会失败(尤其是在 Windows 上)。

If you set the environment variable R_REMOTES_STANDALONE="true" (eg in R Sys.setenv(R_REMOTES_STANDALONE="true")) you can force remotes to operate in standalone mode and use only its internal R implementations.如果您设置环境变量 R_REMOTES_STANDALONE="true"(例如在 R Sys.setenv(R_REMOTES_STANDALONE="true") 中),您可以强制遥控器在独立模式下运行并仅使用其内部 R 实现。 This will allow successful installation of these packages这将允许成功安装这些软件包

With the following lines of code, gt was finally successfull installed from github.通过以下几行代码,终于从github成功安装了gt。

Sys.setenv(R_REMOTES_STANDALONE="true")
remotes::install_github("rstudio/gt")

Thanks all the commentators for your help!感谢所有评论员的帮助!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM