首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在Ubuntu 18.04 LTS上安装rstanarm

无法在Ubuntu 18.04 LTS上安装rstanarm
EN

Stack Overflow用户
提问于 2019-04-10 11:42:05
回答 2查看 1.7K关注 0票数 12

我无法在运行在rstanarm上的R 3.5.3上安装Ubuntu 18.04 LTS。我使用了以下命令:

代码语言:javascript
复制
install.packages("rstanarm")

代码语言:javascript
复制
devtools::install_github("stan-dev/rstanarm", build_vignettes = FALSE)

并且都会引发以下错误:

代码语言:javascript
复制
Execution halted
Makevars:17: recipe for target 'stan_files/lm.cc' failed
make: *** [stan_files/lm.cc] Error 1
ERROR: compilation failed for package ‘rstanarm’

sessionInfo

代码语言:javascript
复制
sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] usethis_1.5.0  devtools_2.0.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1        ps_1.3.0          prettyunits_1.0.2 rprojroot_1.3-2  
 [5] digest_0.6.18     crayon_1.3.4      withr_2.1.2       assertthat_0.2.1 
 [9] R6_2.4.0          backports_1.1.3   magrittr_1.5      rlang_0.3.4      
[13] cli_1.1.0         curl_3.3          fs_1.2.7          remotes_2.0.2    
[17] testthat_2.0.1    callr_3.2.0       desc_1.2.0        tools_3.5.3      
[21] glue_1.3.1        pkgload_1.0.2     compiler_3.5.3    processx_3.3.0   
[25] pkgbuild_1.0.3    sessioninfo_1.1.1 tcltk_3.5.3       memoise_1.1.0    
> 
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-04-13 12:24:26

在Ubuntu18.04+R3.5.3上,您可以通过以下方式安装rstanarm

代码语言:javascript
复制
sudo add-apt-repository -y "ppa:marutter/rrutter"
sudo add-apt-repository -y "ppa:marutter/c2d4u3.5"
sudo apt update
sudo apt install r-cran-rstanarm

关于您以前可能遇到麻烦的一些背景信息:

对于那些使用R3.5.x的用户来说,Ubuntu的RStan安装指南已经过时。

本·古德里奇在评论中链接到RStan GitHub 在Linux上安装RStan指南。在那里,他们为Ubuntu提供以下建议:

代码语言:javascript
复制
# Add marutter's c2d4u repository, (and rrutter for CRAN builds too)
sudo add-apt-repository -y "ppa:marutter/rrutter"
sudo add-apt-repository -y "ppa:marutter/c2d4u"
sudo apt-get update
sudo apt-get install r-cran-rstan

但是,对于更新版本的R,您需要执行以下操作

代码语言:javascript
复制
# Add marutter's c2d4u repository, (and rrutter for CRAN builds too)
sudo add-apt-repository -y "ppa:marutter/rrutter"
sudo add-apt-repository -y "ppa:marutter/c2d4u3.5"
sudo apt-get update
sudo apt-get install r-cran-rstan

这应该可以在Ubuntu18.04+R3.5.3上为您安装RStan。

票数 12
EN

Stack Overflow用户

发布于 2019-04-20 00:11:48

当第一次发生此错误时,假设您的R根目录中有一个R,您很可能会找到一行内容如下:setwd("~/R"),继续注释这一行,重新启动R并获得一个新会话,然后再次运行:install.packages("rstanarm")您应该能够成功安装rstanarm,安装后不要忘记注释setwd("~/R"),出现此错误的原因是rstanarm脚本假定工作目录是包目录的根,如果您想尝试在.Rprofile中调用.Rprofile,则不是这种情况。请删除使用PPA安装的rstanarm

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55611697

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档