4

I'm trying to install packages employing the command install.packages() in Rstudio Version 1.1.453:

R version 3.5.0 (2018-04-23) -- "Joy in Playing"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

with R Version 3.5 in Windows 10:

platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          5.0                         
year           2018                        
month          04                          
day            23                          
svn rev        74626                       
language       R                           
version.string R version 3.5.0 (2018-04-23)
nickname       Joy in Playing 

I'm getting the following error:

Error in install.packages :
    cannot open file 'C:/Users/Gabriel/Documents/R/win-library/3.5/file19281116cee/Rcpp/doc/Rcpp-attributes.pdf':
    Permission denied

Thanks a lot for your help.

Gab
  • 175
  • 1
  • 1
  • 6
  • Possible duplicate of https://stackoverflow.com/questions/42807247/r-installing-package-cannot-open-file-permission-denied. (That is, check anti-virus and/or administrator requirements.) – r2evans Jun 25 '18 at 22:59
  • worked well with the dialog box for installing packages, but not with the command install.packages() – Gab Jun 25 '18 at 23:17
  • It worked only when specifying folder's location path for library: install.packages("PACKAGENAME", lib="C:/Program Files/R/R-3.5.0/library") – Gab Jun 25 '18 at 23:35
  • I think a recent feature of Windows is to lock-down functionality of un-trusted applications, using what I think is [controlled folders](https://learn.microsoft.com/en-us/windows/security/threat-protection/windows-defender-exploit-guard/enable-controlled-folders-exploit-guard). That is, if you can install into `c:/Program Files/R/...` but not into `c:/Users/Gabriel/Documents/...`, then it sounds like it's being protected. – r2evans Jun 25 '18 at 23:48
  • how could be possible to set up the library default location such not to define it in every time I run the command install.packages("PACKAGENAME, lib="PATH2LIB")? – Gab Jun 25 '18 at 23:53
  • Add a call to `.libPaths(c("some/new/path", .libPaths()))` to `~/.Rprofile`. – r2evans Jun 25 '18 at 23:56
  • cannot locate ~/.Rprofile I have for > R.home(component = "home") [1] "C:/PROGRA~1/R/R-35~1.0" – Gab Jun 26 '18 at 00:08
  • Just use any path. The tilde is a convention (that windows does not do well). There are several q/a on SO about windows and its misuse of R's `HOME` envvar. – r2evans Jun 26 '18 at 00:13

3 Answers3

0

I solved it with this answer. It's R is installed as if it needs constant admin privileges. That answer shows the correct way of doing it without running into the problem again.

SafeDev
  • 641
  • 4
  • 12
  • you've linked a question, not an answer. There are several suggested solutions of which none have been accepted (at time of writing), so which did you find useful? – Buzz B Jan 04 '23 at 16:49
0

I ran into same problem, most times it is an antivirus shield issue! Ensure all shields are down, then retry installation.

Cosmin Staicu
  • 1,809
  • 2
  • 20
  • 27
  • If the PDF file was infected by a virus, this answer will not really help. Also don't add "up-vote" recommendations to your answer. Also if you say "same problem" and "most of the time": Was it the same problem? If so, was it a antivirus problem, or wasn't it? – U. Windl Nov 05 '20 at 10:24
0

I had the same problem and it gave me a headache but the Error with : Permission Denied, as you put it across can be solved by checking the antivus. R studio can be blacklisted by the antivirus, so look at the setting. I am using AVG and surely the application was blacklisted. When I removed it from th blacklist, packages were installed successfully

  • Hello and welcome to SO! Please read the [tour](https://stackoverflow.com/tour), and [How do I write a good answer?](https://stackoverflow.com/help/how-to-answer) Try to be more concise, and maybe attach screenshot. – Tomer Shetah Dec 22 '20 at 12:16