permission denied error while building/checking R

2020-02-26 07:00发布

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条回答
爷的心禁止访问
2楼-- · 2020-02-26 07:20

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')"
查看更多
登录 后发表回答