尝试在 R 中安装包 brms

Trying to install package brms in R

我正在尝试在 R 中安装包 brms,以便我可以重命名从函数 stan(来自 rstan 包)返回的参数。当我尝试 install.package("brms", dependencies=TRUE) 时,我将(部分)输出粘贴到此 post 的末尾(粘贴整个内容太长了)。在输出的末尾,您可以看到我得到了一系列“依赖性错误”,这是有道理的,因为第一个错误不是依赖性错误,而是一个编译错误:

compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:168: init.o] Error 1
ERROR: compilation failed for package ‘statmod’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/statmod’

因此出现以下错误是因为第一个错误。但是我不知道如何修复这个编译错误。

In file included from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Core:439,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Dense:1,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h: In instantiation of ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<float, 4, 1>, 0>’:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:300:7:   required from ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<float, 4, 1>, 1>’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:551:7:   required from ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<float, 4, 1>, 3>’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/DenseBase.h:41:34:   required from ‘class Eigen::DenseBase<Eigen::Matrix<float, 4, 1> >’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/MatrixBase.h:48:34:   required from ‘class Eigen::MatrixBase<Eigen::Matrix<float, 4, 1> >’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/PlainObjectBase.h:98:7:   required from ‘class Eigen::PlainObjectBase<Eigen::Matrix<float, 4, 1> >’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/Matrix.h:178:7:   required from ‘class Eigen::Matrix<float, 4, 1>’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:46:50:   required from ‘class Eigen::QuaternionBase<Eigen::Quaternion<float> >’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:250:7:   required from ‘class Eigen::Quaternion<float>’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Geometry/arch/Geometry_SSE.h:27:3:   required from here
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<float>::type’ {aka ‘__vector(4) float’} [-Wignored-attributes]
   55 |                      >::type PacketReturnType;
      |                              ^~~~~~~~~~~~~~~~
In file included from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Core:370,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Dense:1,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/XprHelper.h: In instantiation of ‘struct Eigen::internal::find_best_packet<double, 4>’:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/Matrix.h:22:57:   required from ‘struct Eigen::internal::traits<Eigen::Matrix<double, 4, 1> >’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:242:7:   required from ‘struct Eigen::internal::traits<Eigen::Quaternion<double> >’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Geometry/arch/Geometry_SSE.h:88:47:   required from here
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:187:44: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__vector(2) double’} [-Wignored-attributes]
  187 |          bool Stop = Size==Dynamic || (Size%unpacket_traits<PacketType>::size)==0 || is_same<PacketType,typename unpacket_traits<PacketType>::half>::value>
      |                                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:187:83: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__vector(2) double’} [-Wignored-attributes]
  187 |          bool Stop = Size==Dynamic || (Size%unpacket_traits<PacketType>::size)==0 || is_same<PacketType,typename unpacket_traits<PacketType>::half>::value>
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:187:83: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__vector(2) double’} [-Wignored-attributes]
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:187:83: warning: ignoring attributes on template argument ‘Eigen::internal::unpacket_traits<__vector(2) double>::half’ {aka ‘__vector(2) double’} [-Wignored-attributes]
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/XprHelper.h:205:88: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__vector(2) double’} [-Wignored-attributes]
  205 |   typedef typename find_best_packet_helper<Size,typename packet_traits<T>::type>::type type;
      |                                                                                        ^~~~
In file included from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Core:439,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Dense:1,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h: In instantiation of ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1>, 0>’:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:300:7:   required from ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1>, 1>’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:551:7:   required from ‘class Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1>, 3>’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/DenseBase.h:41:34:   required from ‘class Eigen::DenseBase<Eigen::Matrix<double, 4, 1> >’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/MatrixBase.h:48:34:   required from ‘class Eigen::MatrixBase<Eigen::Matrix<double, 4, 1> >’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/PlainObjectBase.h:98:7:   required from ‘class Eigen::PlainObjectBase<Eigen::Matrix<double, 4, 1> >’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/Matrix.h:178:7:   required from ‘class Eigen::Matrix<double, 4, 1>’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:46:50:   required from ‘class Eigen::QuaternionBase<Eigen::Quaternion<double> >’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Geometry/Quaternion.h:250:7:   required from ‘class Eigen::Quaternion<double>’
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Geometry/arch/Geometry_SSE.h:92:3:   required from here
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__vector(2) double’} [-Wignored-attributes]
   55 |                      >::type PacketReturnType;
      |                              ^~~~~~~~~~~~~~~~
make: *** [/usr/lib/R/etc/Makeconf:177: RcppExports.o] Error 1
ERROR: compilation failed for package ‘mice’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/mice’
Warning in install.packages :
  installation of package ‘mice’ had non-zero exit status
* installing *source* package ‘ape’ ...
** package ‘ape’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/share/R/include" -DNDEBUG   -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/unsupported"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/BH/include" -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/src/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppParallel/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include '/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp'  -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1  -I'/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c BIONJ.c -o BIONJ.o
In file included from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Core:88,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Dense:1,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:1: error: unknown type name ‘namespace’
  628 | namespace Eigen {
      | ^~~~~~~~~
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
  628 | namespace Eigen {
      |                 ^
In file included from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Dense:1,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/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:168: BIONJ.o] Error 1
ERROR: compilation failed for package ‘ape’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/ape’
Warning in install.packages :
  installation of package ‘ape’ had non-zero exit status
* installing *source* package ‘statmod’ ...
** package ‘statmod’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong  -c gaussq2.f -o gaussq2.o
gcc -I"/usr/share/R/include" -DNDEBUG   -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/unsupported"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/BH/include" -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/src/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppParallel/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include '/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp'  -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
In file included from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Core:88,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Dense:1,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:1: error: unknown type name ‘namespace’
  628 | namespace Eigen {
      | ^~~~~~~~~
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
  628 | namespace Eigen {
      |                 ^
In file included from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Dense:1,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/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:168: init.o] Error 1
ERROR: compilation failed for package ‘statmod’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/statmod’
Warning in install.packages :
  installation of package ‘statmod’ had non-zero exit status
ERROR: dependencies ‘sp’, ‘terra’ are not available for package ‘raster’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/raster’
Warning in install.packages :
  installation of package ‘raster’ had non-zero exit status
ERROR: dependencies ‘mvtnorm’, ‘expm’ are not available for package ‘msm’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/msm’
Warning in install.packages :
  installation of package ‘msm’ had non-zero exit status
ERROR: dependency ‘proxy’ is not available for package ‘e1071’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/e1071’
Warning in install.packages :
  installation of package ‘e1071’ had non-zero exit status
ERROR: dependency ‘mvtnorm’ is not available for package ‘bridgesampling’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/bridgesampling’
Warning in install.packages :
  installation of package ‘bridgesampling’ had non-zero exit status
ERROR: dependency ‘mvtnorm’ is not available for package ‘emmeans’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/emmeans’
Warning in install.packages :
  installation of package ‘emmeans’ had non-zero exit status
ERROR: dependencies ‘mvtnorm’, ‘RcppArmadillo’ are not available for package ‘projpred’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/projpred’
Warning in install.packages :
  installation of package ‘projpred’ had non-zero exit status
ERROR: dependency ‘tmvnsim’ is not available for package ‘mnormt’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/mnormt’
Warning in install.packages :
  installation of package ‘mnormt’ had non-zero exit status
ERROR: dependency ‘ape’ is not available for package ‘MCMCglmm’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/MCMCglmm’
Warning in install.packages :
  installation of package ‘MCMCglmm’ had non-zero exit status
ERROR: dependency ‘RcppArmadillo’ is not available for package ‘splines2’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/splines2’
Warning in install.packages :
  installation of package ‘splines2’ had non-zero exit status
ERROR: dependency ‘e1071’ is not available for package ‘classInt’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/classInt’
Warning in install.packages :
  installation of package ‘classInt’ had non-zero exit status
ERROR: dependencies ‘sp’, ‘raster’ are not available for package ‘spData’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/spData’
Warning in install.packages :
  installation of package ‘spData’ had non-zero exit status
ERROR: dependencies ‘evd’, ‘msm’, ‘gsl’ are not available for package ‘rtdists’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/rtdists’
Warning in install.packages :
  installation of package ‘rtdists’ had non-zero exit status
ERROR: dependencies ‘bridgesampling’, ‘nleqslv’ are not available for package ‘brms’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/brms’
Warning in install.packages :
  installation of package ‘brms’ had non-zero exit status
ERROR: dependencies ‘classInt’, ‘units’ are not available for package ‘sf’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/sf’
Warning in install.packages :
  installation of package ‘sf’ had non-zero exit status
ERROR: dependencies ‘sp’, ‘spData’, ‘sf’, ‘deldir’, ‘units’, ‘e1071’ are not available for package ‘spdep’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/spdep’
Warning in install.packages :
  installation of package ‘spdep’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmptxMyN9/downloaded_packages’

编辑: 如果我只是做 install.package("brms"),我会得到一个类似的编译错误:

Installing package into ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
also installing the dependencies ‘mvtnorm’, ‘bridgesampling’, ‘nleqslv’

trying URL 'https://cloud.r-project.org/src/contrib/mvtnorm_1.1-3.tar.gz'
Content type 'application/x-gzip' length 166421 bytes (162 KB)
==================================================
downloaded 162 KB

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.2.tar.gz'
Content type 'application/x-gzip' length 83731 bytes (81 KB)
==================================================
downloaded 81 KB

trying URL 'https://cloud.r-project.org/src/contrib/brms_2.17.0.tar.gz'
Content type 'application/x-gzip' length 5679524 bytes (5.4 MB)
==================================================
downloaded 5.4 MB

* installing *source* package ‘mvtnorm’ ...
** package ‘mvtnorm’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/share/R/include" -DNDEBUG   -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/unsupported"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/BH/include" -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/src/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppParallel/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include '/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp'  -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o
In file included from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Core:88,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Dense:1,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:1: error: unknown type name ‘namespace’
  628 | namespace Eigen {
      | ^~~~~~~~~
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
  628 | namespace Eigen {
      |                 ^
In file included from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Dense:1,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/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:168: C_FORTRAN_interface.o] Error 1
ERROR: compilation failed for package ‘mvtnorm’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/mvtnorm’
Warning in install.packages :
  installation of package ‘mvtnorm’ had non-zero exit status
* installing *source* package ‘nleqslv’ ...
** package ‘nleqslv’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/share/R/include" -DNDEBUG   -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/unsupported"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/BH/include" -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/src/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppParallel/include/"  -I"/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include '/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp'  -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
In file included from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Core:88,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Dense:1,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:1: error: unknown type name ‘namespace’
  628 | namespace Eigen {
      | ^~~~~~~~~
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/util/Macros.h:628:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
  628 | namespace Eigen {
      |                 ^
In file included from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/Dense:1,
                 from /home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 from <command-line>:
/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/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:168: init.o] Error 1
ERROR: compilation failed for package ‘nleqslv’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/nleqslv’
Warning in install.packages :
  installation of package ‘nleqslv’ had non-zero exit status
ERROR: dependency ‘mvtnorm’ is not available for package ‘bridgesampling’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/bridgesampling’
Warning in install.packages :
  installation of package ‘bridgesampling’ had non-zero exit status
ERROR: dependencies ‘bridgesampling’, ‘nleqslv’ are not available for package ‘brms’
* removing ‘/home/mdanb/R/x86_64-pc-linux-gnu-library/4.1/brms’
Warning in install.packages :
  installation of package ‘brms’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmptxMyN9/downloaded_packages’

开始于

install.package("brms")

根据您对目标的描述,避免安装不需要的软件包。如果事实证明您 需要额外的软件包,请将它们一一安装。如果您需要 terrasf 而您不知道如何安装它们,那么您可以在 here or here 或其他地方找到说明。如果都失败了,您可以带着更有针对性的问题回到这里。

正如您在 Ubuntu 上的(根据您的评论),我们可以在这方面为您提供帮助。这里有两种基本方法,我将在 'Basics' 和 'Deluxe'

下进行描述

基础知识

请参阅 this README at CRAN 中的 'Get 5000+ CRAN Packages' 部分以安装 brms 的所有依赖项和包本身。在我刚刚执行的 R-on-Ubuntu-20.04 Docker 容器中

apt install --no-install-recommends r-cran-brms

(并且 root 是隐式的,否则添加 sudo)这会添加 116 个包——包括 brms 本身。

Post 如果您有任何问题,请在此处或 r-sig-debian 列表中提问。

豪华

另请参阅 my blog below code/r4 上关于此的几篇帖子——尤其是 大约 bspm。在 Rocker 容器中 rocker/r-bspm:20.04 你可以只说

 install.packages("brms")

在您的 R 会话中 它会将所有包安装为二进制文件 使您免于任何和所有编译问题。 (我仍然更喜欢 shell 并从 littler 调用 install.r 但这只是我的偏好——它仍然调用 install.packages。)如何设置 CRAN 包 bspm 在其文档中有描述,或者您可以阅读 Dockerfile.

再次强调,如果您有问题,请到 r-sig-debian 列表。

最后,对于您报告的错误,Robert 的建议是正确的:您希望将其逐个包分解并检查依赖包中的错误。 brms 很多 使二进制文件非常有吸引力。