whenever i dowload any package it says failed and says unable to create file

Error Information:

Description of issue -

Steps taken so far -

System Information:

  • RStudio Edition: (Desktop or Server)
  • RStudio Version:
  • OS Version:
  • R Version:

Also:

  • RStudio diagnostics report:
  • Your sessionInfo():
  • RStudio crash report:
  • RStudio application log files:

From Troubleshooting Guide: Using RStudio

Hi @Maqa. We'll need more information in order to help you properly—for example, if you could fill out some of the fields from the troubleshooting guide (eg. system information), and quote the error you're getting word for word, we can start figuring things out :slightly_smiling_face:

I am copying and pasting word to word the message I received. In Italics is what I typed in and after that the output I received. I recived multile of the errors as mentioned below but since I am a new user I can only put 2 liks in my post
I hope you can help. Thank you in anticipation.
Below is the word to word error.

> _install.packages("readr")_
Installing package into ‘C:/Users/maqad/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Warning in install.packages :
  'lib = "C:/Users/maqad/Documents/R/win-library/3.5"' is not writable
Error in install.packages : unable to install packages
> _install.packages("dplyr")_
Installing package into ‘C:/Users/maqad/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Warning in install.packages :
  'lib = "C:/Users/maqad/Documents/R/win-library/3.5"' is not writable
also installing the dependencies ‘utf8’, ‘bindr’, ‘cli’, ‘crayon’, ‘fansi’, ‘pillar’, ‘purrr’, ‘assertthat’, ‘bindrcpp’, ‘glue’, ‘magrittr’, ‘pkgconfig’, ‘R6’, ‘Rcpp’, ‘rlang’, ‘tibble’, ‘tidyselect’, ‘BH’, ‘plogr’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/utf8_1.1.4.zip'
Content type 'application/zip' length 214633 bytes (209 KB)
downloaded 209 KB

I just tried to install the package 'evaluate' and this is the message I received.

Warning in install.packages :
cannot create dir 'C:\Users\maqad\Documents\R\win-library\3.5\file29cc3d7551b8', reason 'No such file or directory'
Error in install.packages : unable to create temporary directory ‘C:\Users\maqad\Documents\R\win-library\3.5\file29cc3d7551b8’

install.packages("evaluate")
Installing package into ‘C:/Users/maqad/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Warning in install.packages :
'lib = "C:/Users/maqad/Documents/R/win-library/3.5"' is not writable
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/evaluate_0.12.zip'
Content type 'application/zip' length 73354 bytes (71 KB)
downloaded 71 KB

Warning in install.packages :
cannot create dir 'C:\Users\maqad\Documents\R\win-library\3.5\file29cc38733404', reason 'No such file or directory'
Error in install.packages : unable to create temporary directory ‘C:\Users\maqad\Documents\R\win-library\3.5\file29cc38733404’

This looks like a permissions issue, are you running rstudio as administrator?

1 Like

sorry I didn't understand this^. I just open R studio with the file my instructor has provided.

You have to run rstudio with administrative rights.

I just opened RStudio as an administrator and installed a package, but I am still unable to install it. I have added an image of the message I received.
This seems really complicated. I hope you can help.

That screen shot does not show any error just the normal installation process, maybe you have to scroll down to the error part?

Sorry about that. This is the screenshot output after all the downloads in red.

Try setting library path like this before installing the libraries

.libPaths(c("C:/Program Files/R/R-3.5.2/library"))

2 Likes

I tried it but it still shows the same message. I also tried loading the packages but apparently they still haven't downloaded.

Did I do this right?
Could you please send a screenshot of how to do it?

Let's back up a little bit, @Maqa. As @andresrcs notes, it seems like there's a permissions problem here: R wants to download and install your packages to a directory in C:\Users\maqad\Documents\R\win-library\3.5 (called your library), but it doesn't have permission to do it.

We more often see these problems with people who're running R on a network and have a shared network disk that they store stuff on, but that doesn't seem to be the case here.

One thing we could try is verifying that this directory hasn't been locked for some reason. Here's a great guide to setting permissions for a directory on Windows:

Another option is to install your packages somewhere else. Here's how to select a different library directory in which to install your packages:

Let us know how you go! :slight_smile:

2 Likes

Thank you so much for the help. I used the second option and it's working now.
Thanks a lot to everyone who helped.

1 Like

I recommend you to check your permissions anyways, because it can cause you more problems in the future.

1 Like

I did check the permissions and allowed myself and my system full access since no one else uses my computer.
I hope that doesn't create problems in the future

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