我在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
cxx14标志=-O3
CXX14PICFLAGS=-fpic
CXX14STD=-std=gnu++1y
-
按照此处所述更新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
通过在R.中输入以下命令解决了问题
install.packages("loo",version="2.3.0")
重新运行
install.packages("rstan")
然后成功运行完成。