Permission denied when I try to install a package

Hi,
I am trying to install the package embarcadero ..but I am having trouble due to a permission problem .
I am running R studio as administrator .. this is the error I am getting

Can anyone help me to sort this out?

> remotes::install_github("cjcarlson/embarcadero")
Downloading GitHub repo cjcarlson/embarcadero@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

 1: All                             
 2: CRAN packages only              
 3: None                            
 4: fs      (1.5.2 -> 1.6.1 ) [CRAN]
 5: stringi (1.7.8 -> 1.7.12) [CRAN]
 6: Rcpp    (1.0.9 -> 1.0.10) [CRAN]
 7: cli     (3.4.1 -> 3.6.0 ) [CRAN]
 8: purrr   (0.3.5 -> 1.0.1 ) [CRAN]
 9: curl    (4.3.3 -> 5.0.0 ) [CRAN]
10: rstatix (0.7.1 -> 0.7.2 ) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 1
fs      (1.5.2 -> 1.6.1 ) [CRAN]
stringi (1.7.8 -> 1.7.12) [CRAN]
Rcpp    (1.0.9 -> 1.0.10) [CRAN]
cli     (3.4.1 -> 3.6.0 ) [CRAN]
purrr   (0.3.5 -> 1.0.1 ) [CRAN]
curl    (4.3.3 -> 5.0.0 ) [CRAN]
rstatix (0.7.1 -> 0.7.2 ) [CRAN]
Skipping 1 packages ahead of CRAN: terra
Installing 7 packages: fs, stringi, Rcpp, cli, purrr, curl, rstatix
Installing packages into β€˜C:/Users/Angela/AppData/Local/R/win-library/4.2’
(as β€˜lib’ is unspecified)

  There are binary versions available but the source versions are later:
        binary source needs_compilation
fs       1.6.0  1.6.1              TRUE
rstatix  0.7.1  0.7.2             FALSE

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/stringi_1.7.12.zip'
Content type 'application/zip' length 14221653 bytes (13.6 MB)
downloaded 13.6 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/Rcpp_1.0.10.zip'
Content type 'application/zip' length 2819280 bytes (2.7 MB)
downloaded 2.7 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/cli_3.6.0.zip'
Content type 'application/zip' length 1298863 bytes (1.2 MB)
downloaded 1.2 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/purrr_1.0.1.zip'
Content type 'application/zip' length 499372 bytes (487 KB)
downloaded 487 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/curl_5.0.0.zip'
Content type 'application/zip' length 2621944 bytes (2.5 MB)
downloaded 2.5 MB

package β€˜stringi’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package β€˜stringi’
Warning: restored β€˜stringi’
package β€˜Rcpp’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package β€˜Rcpp’
Warning: restored β€˜Rcpp’
package β€˜cli’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package β€˜cli’
Warning: restored β€˜cli’
package β€˜purrr’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package β€˜purrr’
Warning: restored β€˜purrr’
package β€˜curl’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package β€˜curl’
Warning: restored β€˜curl’

The downloaded binary packages are in
	C:\Users\Angela\AppData\Local\Temp\Rtmp0OJWHT\downloaded_packages
installing the source packages β€˜fs’, β€˜rstatix’

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

trying URL 'https://cran.rstudio.com/src/contrib/rstatix_0.7.2.tar.gz'
Content type 'application/x-gzip' length 405256 bytes (395 KB)
downloaded 395 KB

* installing *source* package 'fs' ...
** package 'fs' successfully unpacked and MD5 sums checked
ERROR: cannot remove earlier installation, is it in use?
* removing 'C:/Users/Angela/AppData/Local/R/win-library/4.2/fs'
* restoring previous 'C:/Users/Angela/AppData/Local/R/win-library/4.2/fs'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
  problem copying C:\Users\Angela\AppData\Local\R\win-library\4.2\00LOCK-fs\fs\libs\x64\fs.dll to C:\Users\Angela\AppData\Local\R\win-library\4.2\fs\libs\x64\fs.dll: Permission denied
* installing *source* package 'rstatix' ...
** package 'rstatix' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace 'purrr' 0.3.5 is already loaded, but >= 1.0.1 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Execution halted
ERROR: lazy loading failed for package 'rstatix'
* removing 'C:/Users/Angela/AppData/Local/R/win-library/4.2/rstatix'
* restoring previous 'C:/Users/Angela/AppData/Local/R/win-library/4.2/rstatix'

The downloaded source packages are in
	β€˜C:\Users\Angela\AppData\Local\Temp\Rtmp0OJWHT\downloaded_packages’
── R CMD build ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
βœ”  checking for file 'C:\Users\Angela\AppData\Local\Temp\Rtmp0OJWHT\remotes286060704c68\cjcarlson-embarcadero-a3857b3/DESCRIPTION' ...
─  preparing 'embarcadero':
βœ”  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Omitted 'LazyData' from DESCRIPTION
─  building 'embarcadero_1.2.0.1003.tar.gz'
   
Installing package into β€˜C:/Users/Angela/AppData/Local/R/win-library/4.2’
(as β€˜lib’ is unspecified)
* installing *source* package 'embarcadero' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error: package or namespace load failed for 'tidyverse' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 namespace 'purrr' 0.3.5 is already loaded, but >= 1.0.1 is required
In addition: Warning message:
multiple methods tables found for 'metadata' 
Execution halted
ERROR: lazy loading failed for package 'embarcadero'
* removing 'C:/Users/Angela/AppData/Local/R/win-library/4.2/embarcadero'
Warning messages:
1: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Users\Angela\AppData\Local\R\win-library\4.2\00LOCK\stringi\libs\x64\stringi.dll to C:\Users\Angela\AppData\Local\R\win-library\4.2\stringi\libs\x64\stringi.dll: Permission denied
2: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Users\Angela\AppData\Local\R\win-library\4.2\00LOCK\Rcpp\libs\x64\Rcpp.dll to C:\Users\Angela\AppData\Local\R\win-library\4.2\Rcpp\libs\x64\Rcpp.dll: Permission denied
3: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Users\Angela\AppData\Local\R\win-library\4.2\00LOCK\cli\libs\x64\cli.dll to C:\Users\Angela\AppData\Local\R\win-library\4.2\cli\libs\x64\cli.dll: Permission denied
4: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Users\Angela\AppData\Local\R\win-library\4.2\00LOCK\purrr\libs\x64\purrr.dll to C:\Users\Angela\AppData\Local\R\win-library\4.2\purrr\libs\x64\purrr.dll: Permission denied
5: In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Users\Angela\AppData\Local\R\win-library\4.2\00LOCK\curl\libs\x64\curl.dll to C:\Users\Angela\AppData\Local\R\win-library\4.2\curl\libs\x64\curl.dll: Permission denied
6: In i.p(...) : installation of package β€˜fs’ had non-zero exit status
7: In i.p(...) :
  installation of package β€˜rstatix’ had non-zero exit status
8: In i.p(...) :
  installation of package β€˜C:/Users/Angela/AppData/Local/Temp/Rtmp0OJWHT/file2860600a13f1/embarcadero_1.2.0.1003.tar.gz’ had non-zero exit status

It looks like you already have a number of libraries loaded and R cannot update a loaded package. Restart R and RStudio and give it another try.

If you get the same problem it may be that R is automatically restoring your working environment. In that case go to Tools -> Global Options and uncheck Restore .RData into workspace at startup.

1 Like

This topic was automatically closed 7 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.