rstudio packages do not upgrade

Hi, I have an issue with updating the packages in RStudio. This is a bit awkward because I have been using RStudio for a while and is the first time that this issue comes around. First, a message related to Rtools indicating that it didn't available. Ok, I installed again. However, now this message appears when I am trying to update dplyr.

> install.packages("dplyr")
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
       binary source needs_compilation
dplyr 0.8.0.1  0.8.1              TRUE

Do you want to install from sources the package which needs compilation?
y/n: y
installing the source package ‘dplyr’

trying URL 'https://cran.rstudio.com/src/contrib/dplyr_0.8.1.tar.gz'
Content type 'application/x-gzip' length 1170671 bytes (1.1 MB)
downloaded 1.1 MB

ERROR: failed to lock directory 'C:/Users/Usuario/Documents/R/win-library/3.4' for modifying
Try removing 'C:/Users/Usuario/Documents/R/win-library/3.4/00LOCK-dplyr'
In R CMD INSTALL
Warning in install.packages :
  running command '"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" CMD INSTALL -l "C:\Users\Usuario\Documents\R\win-library\3.4" C:\Users\Usuario\AppData\Local\Temp\RtmpshJ4VQ/downloaded_packages/dplyr_0.8.1.tar.gz' had status 3
Warning in install.packages :
  installation of package ‘dplyr’ had non-zero exit status

The downloaded source packages are in
	‘C:\Users\Usuario\AppData\Local\Temp\RtmpshJ4VQ\downloaded_packages’

Please, can anyone help me with that? I will really appreciate any comment.
Regards

1 Like

This error seems to be associated with a previous package installation being interrupted / terminated abnormally. You can fix this by removing the lock file as said. Within the R console, try:

unlink("C:/Users/Usuario/Documents/R/win-library/3.4/00LOCK-dplyr", recursive = TRUE)

I'm following the line of reasoning here;

https://support.rstudio.com/hc/en-us/community/posts/203309146-Build-error


In diagnosing these types of issues, it's important to know the difference between R and RStudio. Package installation is an R issue. RStudio is an IDE for R

2 Likes

Hi. Thanks for your answer and your comments, but the updating process is not working properly yet.
When I install dplyr package, this message appears which is followed when I say "y" to say "yes".

> library(dplyr)
Error: package ‘dplyr’ is not installed for 'arch = x64'
> install.packages("dplyr")
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
       binary source needs_compilation
dplyr 0.8.0.1  0.8.1              TRUE

Do you want to install from sources the package which needs compilation?
y/n: y
installing the source package ‘dplyr’

trying URL 'https://cran.rstudio.com/src/contrib/dplyr_0.8.1.tar.gz'
Content type 'application/x-gzip' length 1170671 bytes (1.1 MB)
downloaded 1.1 MB

* installing *source* package 'dplyr' ...
** package 'dplyr' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
C:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-34~1.3/include" -DNDEBUG -I../inst/include -DRCPP_DEFAULT_INCLUDE_CALL=false -DCOMPILING_DPLYR -DRCPP_USING_UTF8_ERROR_STRING -DRCPP_USE_UNWIND_PROTECT -DBOOST_NO_AUTO_PTR  -I"C:/Users/Usuario/Documents/R/win-library/3.4/BH/include" -I"C:/Users/Usuario/Documents/R/win-library/3.4/plogr/include" -I"C:/Users/Usuario/Documents/R/win-library/3.4/Rcpp/include"        -O2 -Wall  -mtune=generic -c RcppExports.cpp -o RcppExports.o
C:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-34~1.3/include" -DNDEBUG -I../inst/include -DRCPP_DEFAULT_INCLUDE_CALL=false -DCOMPILING_DPLYR -DRCPP_USING_UTF8_ERROR_STRING -DRCPP_USE_UNWIND_PROTECT -DBOOST_NO_AUTO_PTR  -I"C:/Users/Usuario/Documents/R/win-library/3.4/BH/include" -I"C:/Users/Usuario/Documents/R/win-library/3.4/plogr/include" -I"C:/Users/Usuario/Documents/R/win-library/3.4/Rcpp/include"        -O2 -Wall  -mtune=generic -c address.cpp -o address.o

The messages is too long to put it complete so, during a long time of waiting I decided to stop the instalation to change the same option with "n" of "no". Then this message appears:

> install.packages("dplyr", dependencies=TRUE, INSTALL_opts = c('--no-lock'))
Installing package into ‘C:/Users/Usuario/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
       binary source needs_compilation
dplyr 0.8.0.1  0.8.1              TRUE

Do you want to install from sources the package which needs compilation?
y/n: n
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/dplyr_0.8.0.1.zip'
Content type 'application/zip' length 3029353 bytes (2.9 MB)
downloaded 2.9 MB

package ‘dplyr’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\Usuario\AppData\Local\Temp\Rtmpgrdh1l\downloaded_packages

I follow the route provided at the final part of the message, and I notice that the zip file has been put in another file which does not correspond with where the packages are installed.
Please, I help me with this.
Regards

So far you are just showing normal installation messages, dplyr takes a long time to install from source so this is normal.

With the second approach you are not showing any error message either, have you tried to load the library after this?

library(dplyr) 

Hi! Actually, I can use the library after pressing "n" on the installation. The problem is that beside of dplry, I have almost 20 packages that require to update and the procedure is the same as I mentioned.
Dply is one of them.

Ok, but what error messages they are giving you? , if your only concern is about the time they are taking to install from source, then I'm afraid you have no other choice but to be patient.

Honestly, my problem is not the loading time, what really annoys me is that the packages do not update properly and that affects me when I am working with rmarkdown for example.
Minutes ago I uninstalled RStudio, erased the packages that I have been using and when I try to install tidyverse, this message appears when I say "y" and wait.

The downloaded source packages are in
	‘C:\Users\Usuario\AppData\Local\Temp\RtmpwfoUJF\downloaded_packages’

Please, what I am doing wrong? It is a bit annoying do not continue working normally because of this.

Could you post the whole message? Because the part you are posting is just a normal installation message and doesn't indicate any problem. (installation files are always stored in a temp folder regardless of the success or failure of the installation process)

Seems that is the answer that I am looking for. Thanks so much.
Regards

Just one more thing. Months ago, the packages installation or updating did not take so long to install, is there an option for that?. Also, I have noted that my antivirus has been blocking some files to install.

Binary versions of packages install much faster than source versions but they are only available for the latest versions of R and you are using a considerably old version (3.4), try updating to the latest version 3.6.0.

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