Install packages does not work: Permission denied

时光毁灭记忆、已成空白 提交于 2019-12-08 03:33:16

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/50508117/install-packages-does-not-work-permission-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!