Search code examples
rinstall.packagespsych

Install packages does not work: Permission denied


I'm struggling to install the package "psych".

I started to use the command install.packages("psych"). The download started and the result was the following:

Installing package into ‘C:/Users/Username/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependency ‘mnormt’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/mnormt_1.5-5.zip'
Content type 'application/zip' length 373388 bytes (364 KB)
downloaded 364 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/psych_1.8.4.zip'
Content type 'application/zip' length 5741178 bytes (5.5 MB)
downloaded 5.5 MB

Error in install.packages : cannot open file 'C:/Users/Username/Documents/R/win-library/3.5/file41147bc27f90/mnormt/CITATION': Permission denied

After that I searched for results. I disabled my firewall. Also I started RStudio with admin rights. A Suggestion was to install the package in R (not R Studio)

There I tried to install it again. The outcome was the following:

Installing package into ‘C:/Users/Username/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
also installing the dependency ‘mnormt’

trying URL 'https://cran.uni-muenster.de/bin/windows/contrib/3.5/mnormt_1.5-5.zip'
Content type 'application/zip' length 373388 bytes (364 KB)
downloaded 364 KB

trying URL 'https://cran.uni-muenster.de/bin/windows/contrib/3.5/psych_1.8.4.zip'
Content type 'application/zip' length 5741178 bytes (5.5 MB)
downloaded 5.5 MB

Error in unzip(zipname, exdir = dest) : 
  cannot open file 'C:/Users/Username/Documents/R/win-library/3.5/file40fc713ca07/mnormt/CITATION': Permission denied

Do you have any other idea how to fix that? Is there something wrong with the unzip-program?


Solution

  • Can you do .libPaths() ?

    Maybe the .libPaths() doesnt map the correct location (if you are not the administrator)

    Try .libPaths(.libPaths()[2]) then try install.packages("psych") again.