stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.04k stars 269 forks source link

rstan fails to compile on R 4.4 #1126

Closed thommohr closed 5 months ago

thommohr commented 6 months ago

Dear all, since a few weeks r-stan (current cran version) fails to load after compilation with following error:

TypeError: Object # has no method 'imul'

A similar error has been reported here:

https://discourse.mc-stan.org/t/problem-compiling-stan-program-via-brms-on-hpc/26189

The rstan version is 2.32.6

R version: 4.4

Operating system: OpenSuSE Tumbleweed

Thanks for your help,

Thomas

salauer commented 6 months ago

I too would like this to be fixed!

It looks like there is a page for R 4.3 packages (auto download of package list): https://mc-stan.org/r-packages/bin/windows/contrib/4.3/PACKAGES

But the R 4.4 page gives a 404 error: https://mc-stan.org/r-packages/bin/windows/contrib/4.4/PACKAGES

Given that there is a security vulnerability that was fixed in R 4.4.0 (https://thehackernews.com/2024/04/new-r-programming-vulnerability-exposes.html), please update that page accordingly!

Thanks!

SuperSe7enF commented 5 months ago

I had the same problem.

I too would like this to be fixed!

Thanks!

JaneSullivan-NOAA commented 5 months ago

Hi there, is there an update to this issue? Thanks!

andrjohns commented 5 months ago

Hi there, is there an update to this issue? Thanks!

How are you installing rstan and what error do you see?

Note that the R packages repo (https://mc-stan.org/r-packages) has been deprecated and replaced by our R-Universe page. You can see this forum post for more info

JaneSullivan-NOAA commented 5 months ago

@andrjohns Thanks! The setup page you directed me to was super helpful in getting all the parts set up.

SuperSe7enF commented 5 months ago

@andrjohns Thank you for your reply. I still can't get it to install successfully. Here is my environment. Do you have any better suggestion?

TypeError: Object # has no method 'imul'

sessionInfo() R version 4.3.1 (2023-06-16) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.6 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so; LAPACK version 3.7.1

locale: [1] LC_CTYPE=zh_CN.UTF-8 LC_NUMERIC=C LC_TIME=zh_CN.UTF-8 LC_COLLATE=zh_CN.UTF-8
[5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=zh_CN.UTF-8 LC_PAPER=zh_CN.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C

time zone: Asia/Shanghai tzcode source: system (glibc)

attached base packages: [1] grid stats graphics grDevices utils datasets methods base

other attached packages: [1] tidyHeatmap_1.8.1 ComplexHeatmap_2.16.0

loaded via a namespace (and not attached): [1] IRanges_2.34.0 R.methodsS3_1.8.2 GSEABase_1.62.0 urlchecker_1.0.1
[5] nnet_7.3-19 goftest_1.2-3 DT_0.28 HDF5Array_1.28.1
[9] Biostrings_2.68.1 vctrs_0.6.3 spatstat.random_3.1-5 digest_0.6.31
[13] png_0.1-8 shape_1.4.6 proxy_0.4-27 ggrepel_0.9.3
[17] corrplot_0.92 deldir_1.0-9 parallelly_1.36.0 ggheatmap_2.11
[21] MASS_7.3-60 reshape2_1.4.4 httpuv_1.6.11 foreach_1.5.2
[25] BiocGenerics_0.46.0 qvalue_2.32.0 withr_2.5.0 xfun_0.39
[29] ggfun_0.1.0 ggpubr_0.6.0 ellipsis_0.3.2 survival_3.5-5
[33] memoise_2.0.1 clustree_0.5.0 clusterProfiler_4.8.3 gson_0.1.0
[37] profvis_0.3.8 tidytree_0.4.2 zoo_1.8-12 GlobalOptions_0.1.2
[41] pbapply_1.7-0 R.oo_1.25.0 Formula_1.2-5 prettyunits_1.1.1
[45] rematch2_2.1.2 KEGGREST_1.40.0 promises_1.2.0.1 httr_1.4.6
[49] downloader_0.4 rstatix_0.7.2 rhdf5filters_1.12.1 globals_0.16.2
[53] fitdistrplus_1.1-11 rhdf5_2.44.0 ps_1.7.5 rstudioapi_0.14
[57] miniUI_0.1.1.1 generics_0.1.3 DOSE_3.26.1 base64enc_0.1-3
[61] processx_3.8.1 S4Vectors_0.38.1 zlibbioc_1.46.0 ScaledMatrix_1.8.1
[65] ggraph_2.1.0 polyclip_1.10-4 GenomeInfoDbData_1.2.10 quadprog_1.5-8
[69] xtable_1.8-4 stringr_1.5.0 doParallel_1.0.17 evaluate_0.21
[73] S4Arrays_1.2.1 preprocessCore_1.62.1 hms_1.1.3 glmnet_4.1-7
[77] GenomicRanges_1.52.0 irlba_2.3.5.1 colorspace_2.1-0 ROCR_1.0-11
[81] reticulate_1.34.0 spatstat.data_3.0-1 magrittr_2.0.3 lmtest_0.9-40
[85] readr_2.1.4 later_1.3.1 viridis_0.6.3 ggtree_3.8.0
[89] limSolve_1.5.6 lattice_0.21-8 spatstat.geom_3.2-1 future.apply_1.11.0
[93] XML_3.99-0.14 scattermore_1.2 shadowtext_0.1.2 cowplot_1.1.1
[97] matrixStats_1.0.0 RcppAnnoy_0.0.20 class_7.3-22 Hmisc_5.1-0
[101] pillar_1.9.0 nlme_3.1-162 iterators_1.0.14 SeuratWrappers_0.3.1
[105] beachmat_2.16.0 compiler_4.3.1 stringi_1.7.12 tensor_1.5
[109] SummarizedExperiment_1.30.2 dendextend_1.17.1 devtools_2.4.5 plyr_1.8.8
[113] crayon_1.5.2 abind_1.4-5 gridGraphics_0.5-1 locfit_1.5-9.8
[117] sp_1.6-1 graphlayouts_1.0.0 bit_4.0.5 dplyr_1.1.2
[121] fastmatch_1.1-3 codetools_0.2-19 BiocSingular_1.16.0 paletteer_1.5.0
[125] e1071_1.7-13 GetoptLong_1.0.5 plotly_4.10.2 mime_0.12
[129] splines_4.3.1 circlize_0.4.15 Rcpp_1.0.10 sparseMatrixStats_1.12.0
[133] HDO.db_0.99.1 knitr_1.43 blob_1.2.4 utf8_1.2.3
[137] clue_0.3-64 fs_1.6.2 listenv_0.9.0 checkmate_2.2.0
[141] DelayedMatrixStats_1.22.1 GSVA_1.48.1 pkgbuild_1.4.1 ggsignif_0.6.4
[145] ggplotify_0.1.2 tibble_3.2.1 Matrix_1.6-0 callr_3.7.3
[149] tzdb_0.4.0 lpSolve_5.6.18 tweenr_2.0.2 pkgconfig_2.0.3
[153] pheatmap_1.0.12 tools_4.3.1 cachem_1.0.8 RhpcBLASctl_0.23-42
[157] RSQLite_2.3.1 viridisLite_0.4.2 DBI_1.1.3 fastmap_1.1.1
[161] rmarkdown_2.22 scales_1.3.0 usethis_2.2.1 ica_1.0-3
[165] Seurat_4.3.0 broom_1.0.5 patchwork_1.1.3.9000 BiocManager_1.30.21
[169] graph_1.78.0 carData_3.0-5 RANN_2.6.1 rpart_4.1.19
[173] farver_2.1.1 survminer_0.4.9 tidygraph_1.2.3 scatterpie_0.2.1
[177] MatrixGenerics_1.12.2 foreign_0.8-82 cli_3.6.1 purrr_1.0.1
[181] stats4_4.3.1 leiden_0.4.3 lifecycle_1.0.3 uwot_0.1.14
[185] Biobase_2.60.0 sessioninfo_1.2.2 backports_1.4.1 annotate_1.78.0
[189] BiocParallel_1.34.2 gtable_0.3.3 rjson_0.2.21 ggridges_0.5.6
[193] progressr_0.13.0 parallel_4.3.1 ape_5.7-1 limma_3.56.2
[197] jsonlite_1.8.5 edgeR_3.42.4 bitops_1.0-7 ggplot2_3.4.2
[201] bit64_4.0.5 Rtsne_0.16 yulab.utils_0.1.4 spatstat.utils_3.0-3
[205] SeuratObject_4.1.3 GOSemSim_2.26.1 survMisc_0.5.6 R.utils_2.12.2
[209] jjAnno_0.0.3 lazyeval_0.2.2 shiny_1.7.4 htmltools_0.5.5
[213] enrichplot_1.20.0 KMsurv_0.1-5 GO.db_3.17.0 sctransform_0.3.5
[217] glue_1.6.2 XVector_0.40.0 RCurl_1.98-1.12 treeio_1.24.1
[221] GeneTrajectory_1.0.0 gridExtra_2.3 igraph_1.5.0 R6_2.5.1
[225] SingleCellExperiment_1.22.0 tidyr_1.3.0 DESeq2_1.40.2 km.ci_0.5-6
[229] cluster_2.1.4 Rhdf5lib_1.22.0 pkgload_1.3.2 aplot_0.1.10
[233] GenomeInfoDb_1.36.0 DelayedArray_0.26.3 tidyselect_1.2.0 htmlTable_2.4.1
[237] ggforce_0.4.1 car_3.1-2 AnnotationDbi_1.62.1 future_1.32.0
[241] rsvd_1.0.5 munsell_0.5.0 KernSmooth_2.23-22 data.table_1.14.8
[245] htmlwidgets_1.6.2 fgsea_1.26.0 RColorBrewer_1.1-3 rlang_1.1.1
[249] spatstat.sparse_3.0-1 tidyverse_2.0.0 spatstat.explore_3.2-1 IOBR_0.99.9
[253] remotes_2.4.2 fansi_1.0.4

andrjohns commented 5 months ago

How are you installing the package?

SuperSe7enF commented 5 months ago

Hi, the code is as follows,

install.packages("rstan", repos = c("https://stan-dev.r-universe.dev", "https://cloud.r-project.org"))

andrjohns commented 5 months ago

What output do you get from:

sessionInfo(package="rstan")
sessionInfo(package="StanHeaders")
SuperSe7enF commented 5 months ago

Hi, the output is


> sessionInfo(package="rstan")
Error in x$Priority : $ operator is invalid for atomic vectors

> sessionInfo(package="StanHeaders")
R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so;  LAPACK version 3.7.1

locale:
 [1] LC_CTYPE=zh_CN.UTF-8       LC_NUMERIC=C               LC_TIME=zh_CN.UTF-8        LC_COLLATE=zh_CN.UTF-8    
 [5] LC_MONETARY=zh_CN.UTF-8    LC_MESSAGES=zh_CN.UTF-8    LC_PAPER=zh_CN.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C       

time zone: Asia/Shanghai
tzcode source: system (glibc)

attached base packages:
character(0)

other attached packages:
[1] StanHeaders_2.35.0.9000

loaded via a namespace (and not attached):
  [1] IRanges_2.34.0              R.methodsS3_1.8.2           GSEABase_1.62.0             urlchecker_1.0.1           
  [5] nnet_7.3-19                 goftest_1.2-3               DT_0.28                     HDF5Array_1.28.1           
  [9] Biostrings_2.68.1           vctrs_0.6.3                 spatstat.random_3.1-5       digest_0.6.31              
 [13] png_0.1-8                   shape_1.4.6                 proxy_0.4-27                ggrepel_0.9.3              
 [17] corrplot_0.92               deldir_1.0-9                parallelly_1.36.0           ggheatmap_2.11             
 [21] MASS_7.3-60                 reshape2_1.4.4              httpuv_1.6.11               foreach_1.5.2              
 [25] BiocGenerics_0.46.0         qvalue_2.32.0               withr_2.5.0                 xfun_0.39                  
 [29] ggfun_0.1.0                 ggpubr_0.6.0                ellipsis_0.3.2              survival_3.5-5             
 [33] memoise_2.0.1               clustree_0.5.0              utils_4.3.1                 clusterProfiler_4.8.3      
 [37] gson_0.1.0                  tidyHeatmap_1.8.1           profvis_0.3.8               tidytree_0.4.2             
 [41] zoo_1.8-12                  GlobalOptions_0.1.2         pbapply_1.7-0               R.oo_1.25.0                
 [45] Formula_1.2-5               prettyunits_1.1.1           rematch2_2.1.2              KEGGREST_1.40.0            
 [49] promises_1.2.0.1            httr_1.4.6                  downloader_0.4              rstatix_0.7.2              
 [53] rhdf5filters_1.12.1         globals_0.16.2              fitdistrplus_1.1-11         rhdf5_2.44.0               
 [57] ps_1.7.5                    rstudioapi_0.14             miniUI_0.1.1.1              generics_0.1.3             
 [61] DOSE_3.26.1                 base64enc_0.1-3             processx_3.8.1              S4Vectors_0.38.1           
 [65] zlibbioc_1.46.0             ScaledMatrix_1.8.1          ggraph_2.1.0                polyclip_1.10-4            
 [69] quadprog_1.5-8              GenomeInfoDbData_1.2.10     xtable_1.8-4                stringr_1.5.0              
 [73] doParallel_1.0.17           evaluate_0.21               S4Arrays_1.2.1              preprocessCore_1.62.1      
 [77] hms_1.1.3                   glmnet_4.1-7                GenomicRanges_1.52.0        irlba_2.3.5.1              
 [81] colorspace_2.1-0            ROCR_1.0-11                 graphics_4.3.1              reticulate_1.34.0          
 [85] spatstat.data_3.0-1         magrittr_2.0.3              lmtest_0.9-40               readr_2.1.4                
 [89] later_1.3.1                 viridis_0.6.3               ggtree_3.8.0                limSolve_1.5.6             
 [93] lattice_0.21-8              spatstat.geom_3.2-1         future.apply_1.11.0         methods_4.3.1              
 [97] XML_3.99-0.14               scattermore_1.2             shadowtext_0.1.2            cowplot_1.1.1              
[101] matrixStats_1.0.0           RcppAnnoy_0.0.20            class_7.3-22                Hmisc_5.1-0                
[105] pillar_1.9.0                nlme_3.1-162                iterators_1.0.14            SeuratWrappers_0.3.1       
[109] beachmat_2.16.0             compiler_4.3.1              stringi_1.7.12              stats_4.3.1                
[113] tensor_1.5                  SummarizedExperiment_1.30.2 dendextend_1.17.1           devtools_2.4.5             
[117] plyr_1.8.8                  crayon_1.5.2                abind_1.4-5                 gridGraphics_0.5-1         
[121] locfit_1.5-9.8              sp_1.6-1                    graphlayouts_1.0.0          bit_4.0.5                  
[125] dplyr_1.1.2                 fastmatch_1.1-3             codetools_0.2-19            BiocSingular_1.16.0        
[129] e1071_1.7-13                paletteer_1.5.0             GetoptLong_1.0.5            plotly_4.10.2              
[133] mime_0.12                   splines_4.3.1               circlize_0.4.15             Rcpp_1.0.10                
[137] datasets_4.3.1              sparseMatrixStats_1.12.0    HDO.db_0.99.1               knitr_1.43                 
[141] blob_1.2.4                  utf8_1.2.3                  clue_0.3-64                 fs_1.6.2                   
[145] listenv_0.9.0               checkmate_2.2.0             DelayedMatrixStats_1.22.1   GSVA_1.48.1                
[149] pkgbuild_1.4.1              ggsignif_0.6.4              ggplotify_0.1.2             tibble_3.2.1               
[153] Matrix_1.6-0                callr_3.7.3                 tzdb_0.4.0                  lpSolve_5.6.18             
[157] tweenr_2.0.2                pkgconfig_2.0.3             pheatmap_1.0.12             tools_4.3.1                
[161] cachem_1.0.8                RhpcBLASctl_0.23-42         RSQLite_2.3.1               viridisLite_0.4.2          
[165] DBI_1.1.3                   fastmap_1.1.1               rmarkdown_2.22              scales_1.3.0               
[169] grid_4.3.1                  usethis_2.2.1               ica_1.0-3                   Seurat_4.3.0               
[173] broom_1.0.5                 patchwork_1.1.3.9000        BiocManager_1.30.21         graph_1.78.0               
[177] carData_3.0-5               RANN_2.6.1                  rpart_4.1.19                farver_2.1.1               
[181] survminer_0.4.9             tidygraph_1.2.3             scatterpie_0.2.1            MatrixGenerics_1.12.2      
[185] foreign_0.8-82              cli_3.6.1                   purrr_1.0.1                 stats4_4.3.1               
[189] leiden_0.4.3                lifecycle_1.0.3             uwot_0.1.14                 Biobase_2.60.0             
[193] sessioninfo_1.2.2           backports_1.4.1             annotate_1.78.0             BiocParallel_1.34.2        
[197] gtable_0.3.3                rjson_0.2.21                base_4.3.1                  ggridges_0.5.6             
[201] progressr_0.13.0            parallel_4.3.1              ape_5.7-1                   limma_3.56.2               
[205] jsonlite_1.8.5              edgeR_3.42.4                bitops_1.0-7                ggplot2_3.4.2              
[209] bit64_4.0.5                 Rtsne_0.16                  yulab.utils_0.1.4           spatstat.utils_3.0-3       
[213] SeuratObject_4.1.3          GOSemSim_2.26.1             survMisc_0.5.6              R.utils_2.12.2             
[217] jjAnno_0.0.3                lazyeval_0.2.2              shiny_1.7.4                 htmltools_0.5.5            
[221] enrichplot_1.20.0           KMsurv_0.1-5                GO.db_3.17.0                sctransform_0.3.5          
[225] glue_1.6.2                  XVector_0.40.0              RCurl_1.98-1.12             treeio_1.24.1              
[229] GeneTrajectory_1.0.0        gridExtra_2.3               igraph_1.5.0                R6_2.5.1                   
[233] SingleCellExperiment_1.22.0 tidyr_1.3.0                 DESeq2_1.40.2               km.ci_0.5-6                
[237] cluster_2.1.4               Rhdf5lib_1.22.0             pkgload_1.3.2               aplot_0.1.10               
[241] GenomeInfoDb_1.36.0         DelayedArray_0.26.3         tidyselect_1.2.0            htmlTable_2.4.1            
[245] ggforce_0.4.1               car_3.1-2                   AnnotationDbi_1.62.1        future_1.32.0              
[249] rsvd_1.0.5                  munsell_0.5.0               KernSmooth_2.23-22          data.table_1.14.8          
[253] grDevices_4.3.1             htmlwidgets_1.6.2           fgsea_1.26.0                ComplexHeatmap_2.16.0      
[257] RColorBrewer_1.1-3          rlang_1.1.1                 spatstat.sparse_3.0-1       tidyverse_2.0.0            
[261] spatstat.explore_3.2-1      IOBR_0.99.9                 remotes_2.4.2               fansi_1.0.4        
andrjohns commented 5 months ago

It looks like rstan isn't installed:

sessionInfo(package="rstan")
Error in x$Priority : $ operator is invalid for atomic vectors

Did you get an error during the package installation? Can you post the full installation log from trying to install rstan?

SuperSe7enF commented 5 months ago

Well, because I failed to install it. The full installation log was too long. The second half of the installation log was as follows. Let me know if you need more information!


In file included from /home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/Core:271:0,
                 from /home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/Dense:1,
                 from /home/sqq/R/x86_64-pc-linux-gnu-library/4.3/StanHeaders/include/stan/math/prim/fun/Eigen.hpp:22,
                 from ../inst/include/rstan_next/stan_fit_base.hpp:5,
                 from ../inst/include/rstan_next/stan_fit.hpp:5,
                 from stan_fit.cpp:1:
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h: In instantiation of ‘Eigen::Index Eigen::internal::first_default_aligned(const Eigen::DenseBase<Derived>&) [with Derived = Eigen::CwiseBinaryOp<Eigen::internal::scalar_conj_product_op<double, double>, const Eigen::Transpose<const Eigen::Block<const Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, 1, -1, true> >, const Eigen::Block<const Eigen::Matrix<double, -1, -1>, -1, 1, true> >; Eigen::Index = long int]’:
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/src/Core/Redux.h:243:63:   required from ‘static Eigen::internal::redux_impl<Func, Evaluator, 3, 0>::Scalar Eigen::internal::redux_impl<Func, Evaluator, 3, 0>::run(const Evaluator&, const Func&, const XprType&) [with XprType = Eigen::CwiseBinaryOp<Eigen::internal::scalar_conj_product_op<double, double>, const Eigen::Transpose<const Eigen::Block<const Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, 1, -1, true> >, const Eigen::Block<const Eigen::Matrix<double, -1, -1>, -1, 1, true> >; Func = Eigen::internal::scalar_sum_op<double, double>; Evaluator = Eigen::internal::redux_evaluator<Eigen::CwiseBinaryOp<Eigen::internal::scalar_conj_product_op<double, double>, const Eigen::Transpose<const Eigen::Block<const Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, 1, -1, true> >, const Eigen::Block<const Eigen::Matrix<double, -1, -1>, -1, 1, true> > >; Eigen::internal::redux_impl<Func, Evaluator, 3, 0>::Scalar = double]’
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/src/Core/Redux.h:418:56:   required from ‘typename Eigen::internal::traits<T>::Scalar Eigen::DenseBase<Derived>::redux(const Func&) const [with BinaryOp = Eigen::internal::scalar_sum_op<double, double>; Derived = Eigen::CwiseBinaryOp<Eigen::internal::scalar_conj_product_op<double, double>, const Eigen::Transpose<const Eigen::Block<const Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, 1, -1, true> >, const Eigen::Block<const Eigen::Matrix<double, -1, -1>, -1, 1, true> >; typename Eigen::internal::traits<T>::Scalar = double]’
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/src/Core/Redux.h:463:73:   required from ‘typename Eigen::internal::traits<T>::Scalar Eigen::DenseBase<Derived>::sum() const [with Derived = Eigen::CwiseBinaryOp<Eigen::internal::scalar_conj_product_op<double, double>, const Eigen::Transpose<const Eigen::Block<const Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, 1, -1, true> >, const Eigen::Block<const Eigen::Matrix<double, -1, -1>, -1, 1, true> >; typename Eigen::internal::traits<T>::Scalar = double]’
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/src/Core/Dot.h:50:64:   required from ‘static Eigen::internal::dot_nocheck<T, U, true>::ResScalar Eigen::internal::dot_nocheck<T, U, true>::run(const Eigen::MatrixBase<Derived>&, const Eigen::MatrixBase<U>&) [with T = Eigen::Block<const Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, 1, -1, true>; U = Eigen::Block<const Eigen::Matrix<double, -1, -1>, -1, 1, true>; Eigen::internal::dot_nocheck<T, U, true>::ResScalar = double]’
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/src/Core/Dot.h:84:58:   required from ‘typename Eigen::ScalarBinaryOpTraits<typename Eigen::internal::traits<T>::Scalar, typename Eigen::internal::traits<OtherDerived>::Scalar>::ReturnType Eigen::MatrixBase<Derived>::dot(const Eigen::MatrixBase<OtherDerived>&) const [with OtherDerived = Eigen::Block<const Eigen::Matrix<double, -1, -1>, -1, 1, true>; Derived = Eigen::Block<const Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, 1, -1, true>; typename Eigen::ScalarBinaryOpTraits<typename Eigen::internal::traits<T>::Scalar, typename Eigen::internal::traits<OtherDerived>::Scalar>::ReturnType = double]’
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/src/Core/ProductEvaluators.h:380:34:   [ skipping 15 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/src/Core/ProductEvaluators.h:251:23:   required from ‘static void Eigen::internal::generic_product_impl<Lhs, Rhs, Eigen::DenseShape, Eigen::DenseShape, 6>::evalTo(Dst&, const Lhs&, const Rhs&) [with Dst = Eigen::Matrix<double, 1, 1, 0, 1, 1>; Lhs = Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, 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>]’
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/src/Core/ProductEvaluators.h:124:75:   required from ‘Eigen::internal::product_evaluator<Eigen::Product<Lhs, Rhs, Option>, ProductTag, LhsShape, RhsShape>::product_evaluator(const XprType&) [with Lhs = Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, 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; int ProductTag = 6; LhsShape = Eigen::DenseShape; RhsShape = Eigen::DenseShape; typename Eigen::internal::traits<typename Eigen::Product<Lhs, Rhs, Option>::Rhs>::Scalar = double; typename Eigen::internal::traits<typename Eigen::Product<Lhs, Rhs, Option>::Lhs>::Scalar = double; Eigen::internal::product_evaluator<Eigen::Product<Lhs, Rhs, Option>, ProductTag, LhsShape, RhsShape>::XprType = Eigen::Product<Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>, Eigen::Matrix<double, -1, 1>, 0>]’
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/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<double>, 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<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>, Eigen::Matrix<double, -1, 1>, 0>]’
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/src/Core/Product.h:137:22:   required from ‘Eigen::internal::dense_product_base<Lhs, Rhs, Option, 6>::operator const Scalar() const [with Lhs = Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, 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 Option = 0; Eigen::internal::dense_product_base<Lhs, Rhs, Option, 6>::Scalar = double]’
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/StanHeaders/include/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp:22:56:   required from ‘double stan::mcmc::dense_e_metric<Model, BaseRNG>::T(stan::mcmc::dense_e_point&) [with Model = stan::model::model_base; BaseRNG = boost::random::mixmax_engine<17, 36, 0>]’
stan_fit.cpp:1280:1:   required from here
/home/sqq/R/x86_64-pc-linux-gnu-library/4.3/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:654:34: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type {aka __vector(2) double}’ [-Wignored-attributes]
   return internal::first_aligned<int(unpacket_traits<DefaultPacketType>::alignment),Derived>(m);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ar -rs ../inst/lib//libStanServices.a stan_fit.o stan_fit_base.o
ar: 正在创建 ../inst/lib//libStanServices.a
installing to /home/sqq/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-rstan/00new/rstan/libs
** R
** exec
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘rstan’:
 loadNamespace()里算'rstan'时.onLoad失败了,详细内容:
  调用: NULL
  错误: TypeError: Object #<Object> has no method 'imul'
错误: 载入失败
停止执行
andrjohns commented 5 months ago

Can you try adding -w to your CXXFLAGS to suppress the compiler warnings in the output, so that you can post the full log:

if (!(dir.exists("~/.R"))) {
    dir.create("~/.R")
}
cat("CXXFLAGS = -w", sep="\n", append=TRUE, file= "~/.R/Makevars.win")

Then re-running the installation and sharing the log?

SuperSe7enF commented 5 months ago

I apologize for not replying in time. I'm having some trouble on exporting the error logs. The additional file was the full installation log. Thank you very much for your help. rstan_install_output.log

andrjohns commented 5 months ago

I just tried the install in an 18.04 Docker image and all worked without issues, so I'm not sure what the issue might be.

Looking at the log you posted, it includes this line:

Warning message:
The package 'StanHeaders' was built with R version 4.3.1

Which suggests that your current StanHeaders was not built and installed by your current R installation. Can you try:

install.packages("StanHeaders", type="source", repos = c("https://stan-dev.r-universe.dev", "https://cloud.r-project.org"))

And then try the rstan install again?

SuperSe7enF commented 5 months ago

Thanks for your help. I still haven't solved this problem on R 4.3. Maybe I'm having some problems with Ubuntu 18.04 system or R 4.3 in some way. This problem may be solved in the future. Anyway, thank you very much for your guidance.