How to resolvw a problem to Rstudio

Just a few days ago I started working with R and in Rstudio it gives me the following message:

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 ‘C:/Users/ANDREAS/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/dplyr_1.1.0.zip'
Content type 'application/zip' length 1548314 bytes (1.5 MB)
downloaded 1.5 MB

package ‘dplyr’ successfully unpacked and MD5 sums checked
Error in install.packages : ERROR: failed to lock directory ‘C:\Users\ANDREAS\AppData\Local\R\win-library\4.2’ for modifying
Try removing ‘C:\Users\ANDREAS\AppData\Local\R\win-library\4.2/00LOCK’

I saw that someone else had the same problem as me and managed to solve it but it is impossible for me to solve the problem.
I don't know which folder to look in to delete that particular file.

Thank you

this is the folder to look into

R at first tries to install a package to 00LOCK directory. If the process is successful, then it is moved to a regular directory. When errors occur, 00LOCK have to be deleted. But sometimes it does not happen which results in the inability to install new packages. So you have to delete that directory manually:

For this purpose, I have the package pacman installed and its function pacman::p_unlock() that automatically deletes 00LOCK directories. But manual deletion (if you cannot install any packages) also works.

i do not unterstand what exactly I have to to do. Sorry but I'm a total newbie at this

I know but I can't find this file. I have searched a lot. I've been doing this all day today :pensive:

go step by step.
can you find C:\Users ?

Yes. Ι can even find the andreas folder.

Are you able to install pacman package?

If yes, use pacman::p_unlock().

Otherwise, go to C:\Users\ANDREAS\AppData\Local\R\win-library\4.2 and delete all folders that have 00LOCK in their name.

it gives me this message:

Warning in install.packages :
package ‘packman’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at

please try pacman (without k). My apologies for the misspelling.

1 Like

The other issue here can be that you have 2 RStudio sessions open. Try restarting your computer and then try to install dplyr. Make sure that you are not using the RStudio project. Does this work?

To close the project:
image

the same error message

so where do you go off the tracks ?
can you find AppData ?
Local ?

:slight_smile:

No, I can't find AppData. Neither the local.

its likely hidden.
use the view menu to show it.


see 'Hidden items' at the bottom right of this image.

you're AWESOME! I fixed it!!! Thank you a looot!

:smiley:

I fixed it. Thanks a lot!!

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.