【问题标题】:Error instaling rstan on Rstudio Server在 Rstudio 服务器上安装 rstan 时出错
【发布时间】:2013-06-07 18:39:52
【问题描述】:

我们在运行 Rstudio(0.97 版)的服务器上尝试安装 rstan 时遇到问题。 我们使用的是 Ubuntu 12.10(x86_64-pc-linux-gnu(64 位))和 R 2.15.1。

我安装了 Rcpp_0.10.3 和 inline_0.3.11。但是,当我运行时

options(repos = c(getOption("repos"), rstan = "http://wiki.stan.googlecode.com/git/R"))
install.packages('rstan', type = 'source')

我收到以下错误:

g++: error: ***********HYPERATIVA**********: No such file or directory
g++: error: Analytics: No such file or directory
g++: error: Welcome: No such file or directory
g++: error: to: No such file or directory
g++: error: R!: No such file or directory
g++: error: ***********HYPERATIVA**********: No such file or directory
g++: error: Analytics: No such file or directory
g++: error: Goodbye!: No such file or directory
make: *** [rstan.so] Error 1
ERROR: compilation failed for package ‘rstan’
* removing ‘/home/likewise-open/HYPERATIVANET/mgaldino/R/library/rstan’

但是,这些文件夹确实存在,并且在其他软件包中一切正常。 有谁知道该怎么做吗?

【问题讨论】:

  • 您能否验证您是否可以在code.google.com/p/stan/wiki/RStanGettingStarted#C++_compiler 执行“Hello World”示例?看起来好像你有某种定制的启动横幅,它可能是由干扰对 g++ 的调用的 Rprofile 文件生成的。
  • 我刚试了一下,效果很好。
  • 好的,什么文件导致 RStudio 在启动时输出“HYPERATIVA Analytics Welcome to R!”,在关机时输出“HYPERATIVA Analytics Goodbye!”?通常的嫌疑人记录在 help(Startup) 下。此外,它可能是有助于将INSTALL_opts='-d' 参数添加到install_packages() 以获得一些调试信息;例如install.packages('rstan', type = 'source', repos = 'http://wiki.stan.googlecode.com/git/R', INSTALL_opts='-d')
  • 如果安装 R >= 3.0.1 是可行的,那么很可能通过取消设置环境变量 R_MAKEVARS_SITE 和 R_MAKEVARS_USER 来规避此错误。例如,执行Sys.unsetenv('R_MAKEVARS_SITE')Sys.unsetenv('R_MAKEVARS_USER')。请参阅 R 3.0.1 和 help(Sys.unsetenv) 的发行说明中标题为“包安装”的部分。

标签: r installation stan


【解决方案1】:

经过进一步审查,当站点范围或用户的 Rprofile 文件包含诸如“欢迎使用 R!”之类的 cat 调用时,此问题似乎是在 RStan

对于纯 R(不是 RStudio),在 bash shell 中执行:

touch /tmp/Rprofile
export R_PROFILE=/tmp/Rprofile
export R_PROFILE_USER=/tmp/Rprofile
R -e "install.packages('rstan', type='source',repos='http://wiki.stan.googlecode.com/git/R')"
export R_PROFILE=
export R_PROFILE_USER=

如果 RStudio 已经在运行,请在 RStudio 中执行等效操作:

system('touch /tmp/Rprofile')
Sys.setenv(R_PROFILE="/tmp/Rprofile")
Sys.setenv(R_PROFILE_USER="/tmp/Rprofile")
install.packages('rstan', type='source', repos='http://wiki.stan.googlecode.com/git/R')
Sys.unsetenv('R_PROFILE')
Sys.unsetenv('R_PROFILE_USER')

【讨论】:

  • 我在 RStudio 尝试了你的代码,它成功了。非常感谢你。现在是时候尝试用 Stan 拟合一些模型了(我真的很高兴看到 Stan 有多强大,因为我在博士期间用 Bugs 运行了半天的模拟)。
猜你喜欢
  • 2018-03-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-28
  • 2018-11-06
  • 1970-01-01
  • 2016-01-27
  • 2020-01-16
相关资源
最近更新 更多