我在CentOS 7.8.2003上使用R 3.6.0。
我按照以下步骤安装了rstan。
sudo yum install libv8-dev
sudo yum install libv8
创建目录〜/ .R和文件〜/ .R / Makevars
编辑〜/ .R / Makevars
添加以下内容
CXX14 = g ++ -fPIC
CXX14FLAGS = -O3
CXX14PICFLAGS = -fpic
CXX14STD = -std = gnu ++ 1y
按照here所述更新gcc。
在R中:Sys.setenv(TZ =“ Etc / GMT-4”)
在R中:install.packages(“ rstan”)
以
结尾ar -rs ../inst/lib//libStanServices.a stan_fit.o stan_fit_base.o
ar: creating ../inst/lib//libStanServices.a
installing to /home/peter/R/00LOCK-rstan/00new/rstan/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace ‘loo’ 2.2.0 is being loaded, but >= 2.3.0 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Execution halted
ERROR: lazy loading failed for package ‘rstan’
* removing ‘/home/peter/R/rstan’
The downloaded source packages are in
‘/tmp/RtmpZa6XF1/downloaded_packages’
Warning message:
In install.packages("rstan") :
installation of package ‘rstan’ had non-zero exit status
答案 0 :(得分:0)
通过在R中输入以下命令解决了问题。
install.packages("loo",version="2.3.0")
正在运行
install.packages("rstan")
然后成功运行完毕。