permission denied error while building/checking R package on WIndows

懵懂的女人 提交于 2019-11-29 12:33:23

问题


I tried to build the R package hyperSpec using Windows Vista. When I do so, I get the following error message:

warning in file.copy(pkgname, Tdir, recursive = TRUE)
Problem copying .\hyperSpec\data\barbiturates.rda to C:\Users\JenZIG\AppData\Local\Temp\RtmpOEIqBD\Rbuilde446d3a290d\hyperSpec\data\barbiturates.rda: Permission denied

It is all the same whether I use the command line with R CMD build or R Studio's Build Tools (RTools installed, all package dependencies installed).

To solve the problem, I tried to change the path for the temporary directory or to manually set the permissions for the folders but without success. I tried to execute everything as administrator but again no success.

I think, a similar problem was discussed here:

https://stat.ethz.ch/pipermail/r-devel/2013-April/066389.html

However, there is no solution provided for this problem.

In addition, I have the same problem when I try to build the package with Win7.


回答1:


I had this problem. I had previously installed the package in question using the command line:

sudo R -e "install.packages('somepackage', repos='http://cran.rstudio.com/')"

Then when I tried building the somepackage package from source I got the permission denied message.

The solution was to run the following from the command line:

sudo R -e "remove.packages('somepackage')"

Then I was able to build and check somepackage from source.

EDIT

I see that the original question was specific to Windows. In that case I think you simply need to run a powershell window as administrator and use the following command:

Rscript.exe "remove.packages('somepackage')"


来源:https://stackoverflow.com/questions/31471789/permission-denied-error-while-building-checking-r-package-on-windows

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