ImperialCollegeLondon / epidemia

epidemia package
https://imperialcollegelondon.github.io/epidemia/index.html
47 stars 15 forks source link

failed to install from GitHub #59

Closed nadyawilliams closed 3 years ago

nadyawilliams commented 3 years ago

Installing per instructions as devtools::install_github("ImperialCollegeLondon/epidemia")

Throws an error ** using staged installation Error in rstan::stanc(file_name, allow_undefined = TRUE, obfuscate_model_name = FALSE) : 0 Semantic error in 'string', line 3, column 7 to column 14: Identifier 'reverse' clashes with Stan Math library function. Calls: -> sapply -> lapply -> FUN -> Execution halted ERROR: configuration failed for package ‘epidemia’

R version 4.0.4 rstan version 2.26.1 The rest of R modules versions (about 400 total) are as of what was in CRAN as of Mar 17 a week ago.

I don't believe there is an issue with my system. Following rstan install did a check run of rstan examples and pass them fine.

jscott6 commented 3 years ago

Thanks for flagging this. I need to look further but it does not seem possible (at the moment) to compile packages that contain Stan code from source with rstan 2.26.1. That is, even once fixing the name conflict with the epidemia defined function 'reverse' I am still seeing issues.

The problem should resolve if you revert to the latest CRAN version of rstan, which is 2.21.2.

nadyawilliams commented 3 years ago

Thanks for looking into this. Still error after downgrading to rstan 2.21.2:

/opt/apps/R/4.0.4/lib64/R/library/StanHeaders/include/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp:21:10: required from here /opt/apps/R/4.0.4/lib64/R/library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits::type' {aka '__vector(2) double'} [-Wignored-attributes] make: *** [stanExports_epidemia_base.o] Error 1 ERROR: compilation failed for package ‘epidemia’ ─ removing ‘/tmp/RtmpxvU9YQ/Rinst1c53187f23a8/epidemia’

ERROR: package installation failed Error: Failed to install 'epidemia' from GitHub: System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines): E> /opt/apps/R/4.0.4/lib64/R/library/RcppEigen/include/Eigen/src/Core/ProductEvaluators.h:35:90: required from 'Eigen::internal::evaluator<Eigen::Product<Lhs, Rhs, Option> >::evaluator(const XprType&) [with Lhs = Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>; Rhs = Eigen::Matrix<double, -1, 1>; int Options = 0; Eigen::internal::evaluator<Eigen::Product<Lhs, Rhs, Option> >::XprType = Eigen::Product<Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eig

The command line compilation with "R CMD INSTALL ..." on a tar ball created from git checkout fails with the same error.

jscott6 commented 3 years ago

Sorry, you will probably also have to downgrade StanHeaders to the latest CRAN version. (I'm assuming you still have the development version of StanHeaders - i.e. 2.26)

nadyawilliams commented 3 years ago

Yes, this is correct. I had to downgrade StanHeaders and after that was able to compile. Thank you!