开发者

Unable to update R packages in default library on Windows 7

开发者 https://www.devze.com 2023-02-12 00:52 出处:网络
I\'m trying to update packages on RGui (64-bit) using update.packages but I\'m getting the following message:

I'm trying to update packages on RGui (64-bit) using update.packages but I'm getting the following message:

Warning in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl,  :
  'lib = "C:/PROGRA~1/R/R-212~1.1/library"' is not writable
Error in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl,  : 
  unable to install packages

I've looked at the library folder in Explorer and it has read only set, so I removed it. However, it reappears when I check the properties again immediately after doing this. Installing new packages is unaffected since they have a separate fo开发者_如何学编程lder in my user profile.

Is there a trick to getting this to work?


It happens the same to me, and after coding hours and hours in "R" of Gui Project, i got bored because it is much easier to read a code when the interface uses colours for a certain type of words (commands). Well, i decided to install RStudio, but soon i was faced with package installation problems. It seems that happens in Windows 7. The way that I used to solve this problem with RSutido was:

  1. C:\Program Files\R - and this is the folder that contains "R" and not RStudio folder!
  2. Right click for properties.
  3. Security.
  4. In "Group or user names" select your name
  5. click "Edit"
  6. select "Full control"
  7. Apply and click OK

After this steps you should be ok to install all the packages :-)


Usually you need administrator rights to change things in program files. Try running RGui as administrator.


try

install.packages('package_name', lib='folder')

you can specify a folder for installation of the libraries, for which you have writing permission.

Hope this helps


Uninstalling from C:\Program Files and re-installing to C:\R worked for me

[See mdsumner's comment and Windows FAQ found here]

"...Users of Vista/Windows 7/8/Server 2008/2012 installing for a single user using an account with administrator rights1 should consider installing into a non-system area (such as C:\R)"


I had this exact problem and just changed it for myself. That is I navigated to C:/PROGRAM/R and then right clicked on the R to bring up properties. Went to the Security tab clicked on the Group/User that you want to add permissions for. That for me was USER then clicked EDIT and then selected the boxes that were unchecked to Allow control over. I had to do this specifically for each user (of course I was running the entire time as administrator). Clicked Apply/OK and all is well. I can now update/install/ new libraries and what have you for this computer without having to run R as the admin.


Without more information, my first guess is that you have insufficient permissions to write to the R site library folder. Usually, R would prompt for creation of a user lib folder to install to, but this can be unreliable under Windows Vista/Windows 7.

Try:

dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE)

In the R console. Libraries should now install to /Users/"you"/R/win-library/x.y, for which you have the appropriate permissions.


I have BitDefender 2018 and had to disable "safe files" and "firewall".


I had a similar error recently. Running RStudio as an administrator didn't work. And changing the permissions on C:/Programs/R is a bit clumsy, as you'd have to repeat it for every user.

The solution for me was changing the library path for R as follows

  1. In the R console, type .libPaths(). You'll see something like this,

    "Path/to/user/R/win-library/x.x" "C:/Programs/R/R-x.x.x"

    The two paths exist because you have defined a user-specific lib path during installation. Replace x.x.x with your R version.

  2. Now set the lib path to the Programs directory

    .libPaths = "C:/Programs/R/R-x.x.x"

Now you can install.packages() or update.packages()!


Try choosing a cranmirror location closer to you with this command first

chooseCRANmirror()

And then try installing the package. This command worked for me when I was getting warnings on installing "devtools".


I also had this kind of problem in Windows 10, Then I disable "Safe Files" in Bitdefender 2018. It works for me


Sometimes there may also be a possibility that your Antivirus is blocking the application. Unblock the application if anti virus has blocked it.

0

精彩评论

暂无评论...
验证码 换一张
取 消