问题描述
我正在尝试从opencpu访问安装在用户帐户下的R软件包.我可以以该用户身份启动R时看到该软件包已安装:
I am trying to access R packages which were installed under a user's account from opencpu. I can see that the package is installed when I start R as that user:
> installed.packages()
Package LibPath
RLIM "RLIM" "/limdata/ali/R/x86_64-pc-linux-gnu-library/3.0"
...
> system('whoami');
ali
但是,当我尝试从opencpu访问该库时,出现错误,表明未找到该软件包:
However, when I try to access the library from opencpu, I get errors indicating the package was not found:
$ curl -L http://<my.server>/ocpu/user/ali/library/RLIM
there is no package called 'RLIM'
In call:
find.package(pkgname, lib.loc = lib.loc)
# from same server, to confirm opencpu is running...
$ curl -L http://<my.server>/ocpu/library
base
bitops
boot
brew
...
任何帮助将不胜感激!
Any help would be greatly appreciated!
平台信息:
- 主机:Ubuntu 12.04
- opencpu服务器1.0.4-precise0
- opencpu-lib:1.0.4-precise0
- R版本3.0.2(2013-09-25)-飞盘航行"
推荐答案
您的家庭图书馆似乎不在默认位置/home/ali/
.因此,需要一些其他步骤来访问您的软件包.
It seems like your home library is not in the default location of /home/ali/
. Therefore some additional steps are needed to access your packages.
首先,默认的安全配置文件不允许OpenCPU访问/limdata/
.要验证这确实是问题所在,请查看/var/log/kern.log
并搜索包含APPARMOR
和DENIED
的行.请阅读 PDF中标题为"自定义安全配置文件"的部分.服务器手册.
First of all, the default security profile won't allow OpenCPU to access /limdata/
. To verify that this is indeed the problem, have a look at /var/log/kern.log
and search for lines containing APPARMOR
and DENIED
. Please read the section titled Customizing the security profile in the PDF server manual.
要将主库添加到安全配置文件中,请编辑/etc/apparmor.d/opencpu.d/custom
并添加以下行:
To add your home library to the security profile, edit /etc/apparmor.d/opencpu.d/custom
and add these lines:
/limdata/ r,
/limdata/** mrix,
然后,重新启动apparmor并打开opencpu:
Afterwards, restart apparmor and opencpu:
sudo service apparmor restart
sudo service opencpu restart
那应该注意安全性限制.我希望这样做.老实说,我还没有测试主目录位于/home
之外的情况,但是我认为,如果正确配置了R_LIBS_USER
环境变量,它应该可以工作.如果没有,请告诉我:-)
That should take care of the security restrictions. I hope that will do it; honestly I haven't tested a scenario where the home directory is outside of /home
but I think if your R_LIBS_USER
environment variable is properly configured, it should work. If not let me know :-)
这篇关于无法访问opencpu中用户帐户下的R程序包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!