I have been having a problem installing binary packages on Windows, since 3.6.x hit the streets. I am using the
INSTALL_opts = c('--no-lock')
option, but it occurs nevertheless. My habit is to install an update of R (latest, 3.6.2), then run update.packages(.):
trying URL 'https://cran.cnr.berkeley.edu/bin/windows/contrib/3.6/zoib_1.5.4.zip' Content type 'application/zip' length 350788 bytes (342 KB) downloaded 342 KB package ?elasticnet? successfully unpacked and MD5 sums checked package ?ellipse? successfully unpacked and MD5 sums checked package ?elliptic? successfully unpacked and MD5 sums checked package ?EMCluster? successfully unpacked and MD5 sums checked package ?EMD? successfully unpacked and MD5 sums checked Warning: cannot remove prior installation of package ?EMD? Warning in file.copy(savedcopy, lib, recursive = TRUE) : problem copying C:\Program Files\R\R-2.13.1\library\00LOCK\EMD\libs\x64\EMD.dll to C:\Program Files\R\R-2.13.1\library\EMD\libs\x64\EMD.dll: Permission denied Warning: restored ?EMD? package ?emdbook? successfully unpacked and MD5 sums checked package ?emdist? successfully unpacked and MD5 sums checked package ?emmeans? successfully unpacked and MD5 sums checked package ?emoa? successfully unpacked and MD5 sums checked Error in unpackPkgZip(foundpkgs[okp, 2L], foundpkgs[okp, 1L], lib, libs_only, : ERROR: failed to lock directory ?C:\Program Files\R\R-2.13.1\library? for modifying Try removing ?C:\Program Files\R\R-2.13.1\library/00LOCK?
Note the above is preceded by a long list of packages which are, in each case, re-loaded from whatever repo at a mirror being used. I have found the p_unlock() from package pacman useful. After assigning global variable P to the results of available.packages(), I repeatedly do:
p_unlock()
The following 00LOCK has been deleted: C:/Program Files/R/R-2.13.1/library/00LOCK
match(c("emoa"), P)
[1] 13
P<- P[13:length(P)] update.packages(method=NULL, ask=FALSE, checkBuilt=TRUE, type="win.binary", instPkgs=P,
+ dependencies=c("Imports", "Depends", "Suggests"), INSTALL_opts=c("--no-lock"))
where *emoa* is a stand-in for whatever package faulted during the load. (I also have no idea why *EMD* is locked in the above.) My *sessionInfo()* is:
sessionInfo()
R version 3.6.2 (2019-12-12) 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 States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_3.6.2
Eventually, I get to the end of P and call it done. Anyone have a suggestion for an easier workaround? - Jan Galkowski