Ubuntu 22.04下安装R包brms失败:bayesplot无法安装求助
安装R包brms时遇到的问题求助
我的环境信息:
- 系统:Ubuntu 22.04 LTS
- R版本:4.2.2
- RStudio版本:2022.07.2 "Spotted Wakerobin"
- 已成功安装并验证rstan,Stan版本为2.21.0
在RStudio中执行install.packages("brms")时出现错误,具体输出如下:
> install.packages("brms") Installing package into ‘/home/iplank/R/x86_64-pc-linux-gnu-library/4.2’ (as ‘lib’ is unspecified) also installing the dependencies ‘bayesplot’, ‘shinystan’, ‘bridgesampling’, ‘nleqslv’ trying URL 'https://cloud.r-project.org/src/contrib/bayesplot_1.10.0.tar.gz' Content type 'application/x-gzip' length 4993447 bytes (4.8 MB) ================================================== downloaded 4.8 MB trying URL 'https://cloud.r-project.org/src/contrib/shinystan_2.6.0.tar.gz' Content type 'application/x-gzip' length 2399890 bytes (2.3 MB) ================================================== downloaded 2.3 MB trying URL 'https://cloud.r-project.org/src/contrib/bridgesampling_1.1-2.tar.gz' Content type 'application/x-gzip' length 1679600 bytes (1.6 MB) ================================================== downloaded 1.6 MB trying URL 'https://cloud.r-project.org/src/contrib/nleqslv_3.3.3.tar.gz' Content type 'application/x-gzip' length 84686 bytes (82 KB) ================================================== downloaded 82 KB trying URL 'https://cloud.r-project.org/src/contrib/brms_2.18.0.tar.gz' Content type 'application/x-gzip' length 4486548 bytes (4.3 MB) ================================================== downloaded 4.3 MB * installing *source* package ‘bayesplot’ ... ** package ‘bayesplot’ successfully unpacked and MD5 sums checked ** using staged installation ** R ** inst ** byte-compile and prepare package for lazy loading Error in element_line(linewidth = 0.3) : unused argument (linewidth = 0.3) Error: unable to load R code in package ‘bayesplot’ Execution halted ERROR: lazy loading failed for package ‘bayesplot’ * removing ‘/home/iplank/R/x86_64-pc-linux-gnu-library/4.2/bayesplot’ Warning in install.packages : installation of package ‘bayesplot’ had non-zero exit status * installing *source* package ‘bridgesampling’ ... ** package ‘bridgesampling’ successfully unpacked and MD5 sums checked ** using staged installation ** R ** data *** moving datasets to lazyload DB ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (bridgesampling) * installing *source* package ‘nleqslv’ ... ** package ‘nleqslv’ successfully unpacked and MD5 sums checked ** using staged installation ** libs gcc -I"/usr/share/R/include" -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include/" -I"/usr/lib/R/site-library/RcppEigen/include/" -I"/usr/lib/R/site-library/RcppEigen/include/unsupported" -I"/usr/lib/R/site-library/BH/include" -I"/usr/lib/R/site-library/StanHeaders/include/src/" -I"/usr/lib/R/site-library/StanHeaders/include/" -I"/usr/lib/R/site-library/RcppParallel/include/" -I"/home/iplank/R/x86_64-pc-linux-gnu-library/4.2/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include '/usr/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp' -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1 -fpic -g -O2 -ffile-prefix-map=/build/r-base-Faorqz/r-base-4.2.2.20221110=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c init.c -o init.o In file included from /usr/lib/R/site-library/RcppEigen/include/Eigen/Core:88, from /usr/lib/R/site-library/RcppEigen/include/Eigen/Dense:1, from /usr/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13, from <command-line>: /usr/lib/R/site-library/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:1: error: unknown type name ‘namespace’ 628 | namespace Eigen { | ^~~~~~~~~ /usr/lib/R/site-library/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 628 | namespace Eigen { | ^ In file included from /usr/lib/R/site-library/RcppEigen/include/Eigen/Dense:1, from /usr/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13, from <command-line>: /usr/lib/R/site-library/RcppEigen/include/Eigen/Core:96:10: fatal error: complex: No such file or directory 96 | #include <complex> | ^~~~~~~~~ compilation terminated. make: *** [/usr/lib/R/etc/Makeconf:169: init.o] Error 1 ERROR: compilation failed for package ‘nleqslv’ * removing ‘/home/iplank/R/x86_64-pc-linux-gnu-library/4.2/nleqslv’ Warning in install.packages : installation of package ‘nleqslv’ had non-zero exit status ERROR: dependency ‘bayesplot’ is not available for package ‘shinystan’ * removing ‘/home/iplank/R/x86_64-pc-linux-gnu-library/4.2/shinystan’ Warning in install.packages : installation of package ‘shinystan’ had non-zero exit status ERROR: dependencies ‘bayesplot’, ‘shinystan’, ‘nleqslv’ are not available for package ‘brms’ * removing ‘/home/iplank/R/x86_64-pc-linux-gnu-library/4.2/brms’ Warning in install.packages : installation of package ‘brms’ had non-zero exit status The downloaded source packages are in ‘/tmp/RtmpS56F1Q/downloaded_packages’
问题主要出在bayesplot的安装环节,但我不清楚具体解决方法,希望能得到相关建议。
内容的提问来源于stack exchange,提问作者Max
相关产品推荐
相关产品推荐

