Problems with the updates in some packages

I am presenting problems with the updates in some packages. Here I show you an example:

install.packages("ggplot2")
Installing package into ‘C:/Users/hermesr/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependency ‘isoband’


  There is a binary version available but the source version is later:
        binary source needs_compilation
ggplot2  3.2.1  3.3.0             FALSE

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/isoband_0.2.0.zip'
Content type 'application/zip' length 2899884 bytes (2.8 MB)
downloaded 2.8 MB

package ‘isoband’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘C:\Users\hermesr\Documents\R\win-library\3.6’ for modifying
Try removing ‘C:\Users\hermesr\Documents\R\win-library\3.6/00LOCK’

The last alert that is read: it is common for other packages:

**Error in install.packages : ERROR: failed to lock directory ‘C:\Users\hermesr\Documents\R\win-library\3.6’ for modifying**
**Try removing ‘C:\Users\hermesr\Documents\R\win-library\3.6/00LOCK’**

How to solve this problem?

Generically, this is a permissions problem--the user under which R is running doesn't have the rights to perform needed operations. In the *nices world, this can be overcome by running under sudo, but it's been so long since I've used Windows, I don''t know the equivalent.

The first thing to try is the suggestion on the last line, to remove the lock file manually and then attempt the upgrade again.

I also experienced this problem, for me, Rlang package was problem.

and I found that problem appears in case of package installation has stopped (in my case).

To solve problem.

  • 1, Clear that Locked directory mentioned from console.
    in your case, C:\Users\hermesr\Documents\R\win-library\3.6/00LOCK should be removed.

my case was Rlang and it still exists even problem has solved. :frowning:

image .

  • 2, Clear R workspace, it includes re-start R ( Rstudio )

  • 3, install problematic packages independently first, In your case. it will be isoband package.

  • Last, it's time to install original package again.

install.package('ggplot2')

in these steps, you might have to repeat their step and as @technocrat saids, run rstudio as admin mode will be helpful. it can be achieved like this figure with right-click it. ( sorry for language, but I believe you can understand )

image

Good luck.

2 Likes

Thank you,
Restarting R and eliminating 00LOCK, I managed to update the packages.
But at times the alerts that I showed in above were repeated.
resolving, again, with the procedure described by jhk0530.

I'm sorry it wasn't helpful. :sob:

if possible,
upload all error message might be helpful for me or other gurus to solve problem.

Regards

This is common problem and it happens (to me) all the time. This is connected either with LOCK folders or permissions.
I asked about it here: https://forum.posit.co/t/i-cant-install-dplyr-dev-version-and-rlang-dev-version-on-windows-10/48080.
But some of these packages are installing correctly without any hassle and some of them are not (especially group updates for dev versions packages). So in my humble opinion it depends on how the package is written and checked. Never happened when installing from CRAN.

My solution is as follows:

  1. Remove LOCK folders.
  2. Run RStudio with Admin rights.
  3. Install packages one by one not in a group way.
  4. If this really not working at all, I install a problematic package in a different folder (eg. Temp) and then I copy that folder into my R library system folder (with overwriting the existing folder) and it works.
    5.Then I wait until a package is on CRAN and I install it without any problems.

regards,

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.