简体   繁体   English

R install.packages 返回“错误:锁定目录失败”

[英]R install.packages returns 'ERROR: failed to lock directory'

[Similar question to 14382209 but suggestions there haven't solved this issue] [与14382209类似的问题,但那里的建议尚未解决此问题]

New installation of R 4.0.0 and tidyverse on a Windows 7 work computer returns this classic failed to create lock directory error在 Windows 7 工作计算机上新安装 R 4.0.0 和tidyverse返回此经典无法创建锁定目录错误

 install.packages('tidyverse')
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 ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com/users/A04/ocarrib/R/win-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘highr’, ‘markdown’, ‘testthat’, ‘RColorBrewer’, ‘viridisLite’, ‘askpass’, ‘rematch’, ‘prettyunits’, ‘processx’, ‘knitr’, ‘yaml’, ‘htmltools’, ‘evaluate’, ‘base64enc’, ‘tinytex’, ‘xfun’, ‘backports’, ‘generics’, ‘reshape2’, ‘assertthat’, ‘glue’, ‘fansi’, ‘DBI’, ‘lifecycle’, ‘R6’, ‘tidyselect’, ‘ellipsis’, ‘pkgconfig’, ‘Rcpp’, ‘BH’, ‘plogr’, ‘digest’, ‘gtable’, ‘isoband’, ‘scales’, ‘withr’, ‘vctrs’, ‘curl’, ‘mime’, ‘openssl’, ‘utf8’, ‘clipr’, ‘cellranger’, ‘progress’, ‘callr’, ‘fs’, ‘rmarkdown’, ‘whisker’, ‘selectr’, ‘stringi’, ‘broom’, ‘cli’, ‘crayon’, ‘dbplyr’, ‘dplyr’, ‘forcats’, ‘ggplot2’, ‘haven’, ‘hms’, ‘httr’, ‘jsonlite’, ‘lubridate’, ‘magrittr’, ‘modelr’, ‘pillar’, ‘purrr’, ‘readr’, ‘readxl’, ‘reprex’, ‘rlang’, ‘rstudioapi’, ‘rvest’, ‘stringr’, ‘tibble’, ‘tidyr’, ‘xml2’


  There are binary versions available but the source versions are later:
       binary source needs_compilation
modelr  0.1.6  0.1.7             FALSE
xml2    1.3.1  1.3.2              TRUE

  Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/highr_0.8.zip'
Content type 'application/zip' length 48579 bytes (47 KB)
downloaded 47 KB

# .... Output edited for brevity #

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/tidyverse_1.3.0.zip'
Content type 'application/zip' length 440009 bytes (429 KB)
downloaded 429 KB

package ‘highr’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com\users\A04\ocarrib\R\win-library\4.0’ for modifying
Try removing ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com\users\A04\ocarrib\R\win-library\4.0/00LOCK’

Then trialling rtools然后试用rtools

 install.packages('rtools')
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 ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com/users/A04/ocarrib/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘rtools’ is not available (for R version 4.0.0)

Then trialled: - Deletion 00lock folder directly from stated location (~A04\ocarrib\R\win-library\4.0/00LOCK) - restarting R - No luck, same error然后试用: - 直接从指定位置删除00lock文件夹 (~A04\ocarrib\R\win-library\4.0/00LOCK) - 重新启动 R - 不走运,同样的错误

Then trialled with options:然后试用选项:

> install.packages("tidyverse", dependencies = TRUE, INSTALL_opts = '--no-lock')
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 ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com/users/A04/ocarrib/R/win-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘RColorBrewer’, ‘viridisLite’, ‘askpass’, ‘rematch’, ‘prettyunits’, ‘processx’, ‘lazyeval’, ‘backports’, ‘generics’, ‘reshape2’, ‘assertthat’, ‘fansi’, ‘DBI’, ‘lifecycle’, ‘R6’, ‘tidyselect’, ‘ellipsis’, ‘pkgconfig’, ‘Rcpp’, ‘BH’, ‘plogr’, ‘digest’, ‘gtable’, ‘isoband’, ‘scales’, ‘withr’, ‘vctrs’, ‘curl’, ‘mime’, ‘openssl’, ‘utf8’, ‘clipr’, ‘cellranger’, ‘progress’, ‘callr’, ‘fs’, ‘whisker’, ‘selectr’, ‘stringi’, ‘rex’, ‘yaml’, ‘evaluate’, ‘highr’, ‘markdown’, ‘xfun’, ‘htmltools’, ‘base64enc’, ‘tinytex’, ‘broom’, ‘cli’, ‘crayon’, ‘dbplyr’, ‘dplyr’, ‘forcats’, ‘ggplot2’, ‘haven’, ‘hms’, ‘httr’, ‘jsonlite’, ‘lubridate’, ‘magrittr’, ‘modelr’, ‘pillar’, ‘purrr’, ‘readr’, ‘readxl’, ‘reprex’, ‘rlang’, ‘rstudioapi’, ‘rvest’, ‘stringr’, ‘tibble’, ‘tidyr’, ‘xml2’, ‘covr’, ‘feather’, ‘glue’, ‘knitr’, ‘rmarkdown’, ‘testthat’


  There are binary versions available but the source versions are later:
       binary source needs_compilation
modelr  0.1.6  0.1.7             FALSE
xml2    1.3.1  1.3.2              TRUE

  Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/RColorBrewer_1.1-2.zip'
Content type 'application/zip' length 55583 bytes (54 KB)
downloaded 54 KB

# Output edited for brevity

package ‘RColorBrewer’ successfully unpacked and MD5 sums checked
package ‘viridisLite’ successfully unpacked and MD5 sums checked
package ‘askpass’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com\users\A04\ocarrib\R\win-library\4.0’ for modifying
Try removing ‘\\ukbia04sfsrv002.a04.dt21.svcs.hp.com\users\A04\ocarrib\R\win-library\4.0/00LOCK’

Any other thoughts??还有什么想法吗??

Session info: Session 信息:

> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

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

loaded via a namespace (and not attached):
[1] compiler_4.0.0 tools_4.0.0 
  1. Open the R folder (where you first save R after downloading)打开R文件夹(下载后首先保存R)

  2. Remove 00lock folder by changing its place - cut and paste to another place.通过更改位置来删除00lock文件夹 - 剪切并粘贴到另一个位置。

  3. Try to download the library.尝试下载库。

In case you're using Ubuntu Linux, you can find the folder 00LOCK-<package> in the location /home/enigmo/R/x86_64-pc-linux-gnu-library/<your-R-version> .如果您使用的是 Ubuntu Linux,您可以在/home/enigmo/R/x86_64-pc-linux-gnu-library/<your-R-version>位置找到文件夹00LOCK-<package> >。 After you removed the folder 00LOCK-<package> , try to install the package again, it should work now!删除文件夹00LOCK-<package>后,尝试再次安装 package,它现在应该可以工作了!

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

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