在 WINdows 上构建/检查 R 包时权限被拒绝错误 [英] permission denied error while building/checking R package on WIndows
问题描述
我尝试使用 Windows Vista 构建 R 包 hyperSpec
.当我这样做时,我收到以下错误消息:
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
无论我使用带有 R CMD build
的命令行还是 R Studio 的构建工具(安装了 RTools,安装了所有包依赖项)都是一样的.
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.
另外,当我尝试使用 Win7 构建包时,我也遇到了同样的问题.
In addition, I have the same problem when I try to build the package with Win7.
推荐答案
我遇到了这个问题.我以前使用命令行安装了有问题的包:
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/')"
然后,当我尝试从源代码构建 somepackage
包时,我收到了 permission denied 消息.
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')"
然后我能够从源代码构建和检查somepackage
.
Then I was able to build and check somepackage
from source.
编辑
我看到原来的问题是针对 Windows 的.在这种情况下,我认为您只需要以管理员身份运行 powershell 窗口并使用以下命令:
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')"
这篇关于在 WINdows 上构建/检查 R 包时权限被拒绝错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!