Reputation: 282
I know that this question is similar to previously asked questions. However, this question differs in some ways.
I have not been able to install any packages into R for some time now. Here's the code:
install.packages("GGally")
Installing package into ‘C:/Users/my_usernames/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
'lib = "C:/Users/my_username/Documents/R/win-library/4.1"' is not writable
After this, the system keeps prompting me to use a personal library, to which I clicked Yes
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/GGally_2.1.2.zip'
Content type 'application/zip' length 1637552 bytes (1.6 MB)
downloaded 1.6 MB
Warning in install.packages :
cannot create dir 'C:\Users\my_username\Documents\R\win-library\4.1\file778128e2f03', reason 'No such file or directory'
Error in install.packages : unable to create temporary directory ‘C:\Users\my_username\Documents\R\win-library\4.1\file778128e2f03’
Some things that I did but didn't work out:
Running RStudio with administrator privilege
Using Tools > Install Packages --> after this, a prompt to create a personal library appears, and if I click Yes
, the prompt keeps reappearing without any action
Checking the folder manually, and I found that the path C:\Users\my_username\Documents\R\win-library\4.1\
exists
Using dir.create
and .libPaths()
as suggested by teichert
in a previous thread
dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE)
.libPaths(Sys.getenv("R_LIBS_USER"))
I also found that some people suggested to configure my R profile using
export R_LIBS_USER=/path/to/your/r-library
or
sudo usermod -a -G staff your_user_name
However, I didn't use any profile while using R or RStudio, so I'm not sure if I have any username or any RStudio profile. I didn't recently update my R or RStudio application as well. I haven't used R or RStudio in a while, and when I opened them again last week the issue pops up.
Any help will be much appreciated. Thank you very much in advance.
Upvotes: 0
Views: 3701
Reputation: 617
I had the same problem with R 4.1.0, where R uses the Documents folder to store the plugins, i.e. application data. This is obviously wrong, against the MS guidelines and would make OneDrive go crazy, which imho may be why this problem appears. In my case, the problem was installing a new version of htmltools
package.
I fixed it with a clean installation of R 4.3.3
, which probably fixed this. The steps:
Packages/Install package(s)
, choose repository and then the packageyes
yes
It should work now. As an alternative, you can follow these steps and you should be able to relocate your plugin library (e.g to %AppData%/R/[your-version]/
). I have not tried, cannot confirm.
Upvotes: 0
Reputation: 1
install.packages("GGally")
Installing package into ‘C:/Users/my_usernames/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
'lib = "C:/Users/my_username/Documents/R/win-library/4.1"' is not writable
Maybe you should change "my_usernames" part. you write your your own name
Upvotes: -2
Reputation: 1
After this, the system keeps prompting me to use a personal library, to which I clicked Yes "try to click no"
Upvotes: -3
Reputation: 1
maybe you need to run Rstudio as "administrator" to be able to install on this folder. so you can fix that problem
Upvotes: -4