R-在安装软件包的开发人员版本时更新rlang问题

时间:2019-04-23 01:18:27

标签: r

我正在尝试安装tidyr的开发版本。当我尝试devtools::install_github("tidyverse/tidyr")remotes::install_github("tidyverse/tidyr")时,出现以下错误:

> devtools::install_github("tidyverse/tidyr")
Downloading GitHub repo tidyverse/tidyr@master
Downloading GitHub repo r-lib/vctrs@master
These packages have more recent versions available.
Which would you like to update?

1:   All
2:   CRAN packages only
3:   None
4:   rlang    (0.3.4 -> 18856f22a...) [GitHub]
5:   ellipsis (0.1.0 -> 9908b24a2...) [GitHub]

Enter one or more numbers separated by spaces, or an empty line to cancel
1: 1
rlang    (0.3.4 -> 18856f22a...) [GitHub]
ellipsis (0.1.0 -> 9908b24a2...) [GitHub]
Downloading GitHub repo r-lib/rlang@master
√  checking for file 'C:\Users\owner\AppData\Local\Temp\RtmpYDrYNh\remotes96bc1c295445\r-lib-rlang-18856f2/DESCRIPTION' ...
-  preparing 'rlang': (2s)
√  checking DESCRIPTION meta-information ... 
-  cleaning src
-  installing the package to process help pages (1.3s)
-  cleaning src (27.6s)
-  checking for LF line-endings in source and make files and shell scripts (445ms)
-  checking for empty or unneeded directories (878ms)
-  building 'rlang_0.3.4.9002.tar.gz'

Installing package into ‘C:/Users/owner/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
ERROR: failed to lock directory 'C:/Users/owner/Documents/R/win-library/3.5' for modifying
Try removing 'C:/Users/owner/Documents/R/win-library/3.5/00LOCK-rlang'
In R CMD INSTALL
Error in i.p(...) : 
  (converted from warning) installation of package ‘C:/Users/owner/AppData/Local/Temp/RtmpYDrYNh/file96bc24b12ee3/rlang_0.3.4.9002.tar.gz’ had non-zero exit status

我已按照警告提示删除00LOCK-rlang,然后重试。和以前一样,我被问到要更新哪些软件包,然后选择All。这次,当我尝试更新rlang时收到以下错误:

installing to C:/Users/owner/Documents/R/win-library/3.5/rlang/libs/x64
Error in file.copy(files, dest, overwrite = TRUE) : 
  (converted from warning) problem copying .\rlang.dll to C:\Users\owner\Documents\R\win-library\3.5\rlang\libs\x64\rlang.dll: Permission denied
* removing 'C:/Users/owner/Documents/R/win-library/3.5/rlang'
* restoring previous 'C:/Users/owner/Documents/R/win-library/3.5/rlang'
Error in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) : 
  (converted from warning) problem copying C:\Users\owner\Documents\R\win-library\3.5\00LOCK-rlang\rlang\libs\x64\rlang.dll to C:\Users\owner\Documents\R\win-library\3.5\rlang\libs\x64\rlang.dll: Permission denied
Execution halted
In R CMD INSTALL
Error in i.p(...) : 
  (converted from warning) installation of package ‘C:/Users/owner/AppData/Local/Temp/RtmpYDrYNh/file96bc74433a2d/rlang_0.3.4.9002.tar.gz’ had non-zero exit status

第二次尝试后的会话信息:

> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1        rstudioapi_0.10   magrittr_1.5      usethis_1.5.0     devtools_2.0.2    pkgload_1.0.2     R6_2.4.0          rlang_0.3.4       tools_3.5.2       pkgbuild_1.0.3   
[11] sessioninfo_1.1.1 cli_1.1.0         withr_2.1.2       remotes_2.0.4     yaml_2.2.0        assertthat_0.2.1  digest_0.6.18     rprojroot_1.3-2   crayon_1.3.4      processx_3.3.0   
[21] callr_3.2.0       fs_1.2.7          ps_1.3.0          curl_3.3          rpart_4.1-15      testthat_2.0.1    glue_1.3.1        memoise_1.1.0     compiler_3.5.2    desc_1.2.0       
[31] backports_1.1.4   prettyunits_1.0.2

使用source("https://install-github.me/r-lib/rlang")解决了问题,但是为什么devtools::remotes::install_github()失败了?

2 个答案:

答案 0 :(得分:1)

我也遇到了这个问题。请注意[...]\rlang\libs\x64\rlang.dll: Permission denied。当前的R会话不允许访问这些文件。为了避免这种情况,请通过Rgui.exe在Windows搜索中搜索Rgui或通过Win+Q打开C:\Program Files\R\R-3.5.3\bin\x64\Rgui.exe。右键单击并按Run as administrator,然后执行与以前相同的操作。

您也可以在管理模式下运行RStudio。

答案 1 :(得分:1)

我找到了一个略有不同的解决方案。

  1. 以管理员身份打开Rgui.exe。我认为您实际上不需要以管理员身份打开Rgui.exe,但是我这样做了,我将其保留。
  2. C:\...\R\win-library\3.5\rlang移动到另一个文件夹(该目录中没有rlang文件夹)
  3. install.packages("rlang")
  4. 关闭Rgui
  5. 开始一个新的(正常)会话并享受!