rstan icon indicating copy to clipboard operation
rstan copied to clipboard

Error in dyn.load(libLFile)

Open barracuda156 opened this issue 2 years ago • 0 comments

Could someone advise me on the following error:

library(rstan) Loading required package: StanHeaders Loading required package: ggplot2 rstan (Version 2.21.2, GitRev: 2e1f913d3ca3) For execution on a local, multicore CPU with excess RAM we recommend calling options(mc.cores = parallel::detectCores()). To avoid recompilation of unchanged Stan programs, we recommend calling rstan_options(auto_write = TRUE) Warning message: In file(con, "r") : cannot open file '/var/db/timezone/zoneinfo/+VERSION': No such file or directory sink("bernoulli.stan") cat("

  • data { // data provided by the user
  • int<lower=1> N;
  • int<lower=0, upper=1> x[N];
  • }
  • parameters { // parameters to be inferred
  • real<lower=0, upper=1> theta;
  • }
  • model { // probability model
  • for (i in 1:N) {
  • x[i] ~ bernoulli(theta);
  • }
  • }
  • ",fill=T)

sink() x_dat <- list(N = 10,

  • x = c(1,1,1,0,0,1,0,0,1,0))

fit0 <- stan(file = 'bernoulli.stan', data = x_dat,

  • iter = 1000, chains = 4) Error in dyn.load(libLFile) : unable to load shared object '/var/folders/rD/rDeCM6SDHv8daLCecrRmrU+++TI/-Tmp-//RtmpTqVb7G/file3e7b3ef33ae3.so': dlopen(/var/folders/rD/rDeCM6SDHv8daLCecrRmrU+++TI/-Tmp-//RtmpTqVb7G/file3e7b3ef33ae3.so, 6): Library not loaded: @rpath/libtbb.dylib Referenced from: /var/folders/rD/rDeCM6SDHv8daLCecrRmrU+++TI/-Tmp-//RtmpTqVb7G/file3e7b3ef33ae3.so Reason: image not found Error in sink(type = "output") : invalid connection

RcppParallels is built and installed. From what I understand, it has its own version of TBB, however for whatever reason Rstan does not load it. (Building standalone TBB fails on PowerPC, at least as of now, so that is not an option.)

Basic Rcpp functionality works:

fx <- inline::cxxfunction( signature(x = "integer", y = "numeric" ) , '

  • return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
  • ' )

fx( 2L, 5 ) [1] 10

sessionInfo() R version 4.1.2 (2021-11-01) Platform: powerpc-apple-darwin10.0.0d2 (32-bit) Running under: OS X Snow Leopard 10.6

Matrix products: default BLAS: /opt/local/Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.dylib LAPACK: /opt/local/Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale: [1] en_US.utf-8/en_US.utf-8/en_US.utf-8/C/en_US.utf-8/en_US.utf-8

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

other attached packages: [1] rstan_2.21.2 ggplot2_3.3.5 StanHeaders_2.21.0-7 [4] Rcpp_1.0.7.3 inline_0.3.19

loaded via a namespace (and not attached): [1] pillar_1.6.4 compiler_4.1.2 prettyunits_1.1.1 tools_4.1.2
[5] pkgbuild_1.2.1 lifecycle_1.0.1 tibble_3.1.6 gtable_0.3.0
[9] pkgconfig_2.0.3 rlang_0.4.12 DBI_1.1.1 cli_3.1.0
[13] parallel_4.1.2 loo_2.4.1 gridExtra_2.3 withr_2.4.3
[17] dplyr_1.0.7 generics_0.1.1 vctrs_0.3.8 stats4_4.1.2
[21] grid_4.1.2 tidyselect_1.1.1 glue_1.5.1 R6_2.5.1
[25] processx_3.5.2 fansi_0.5.0 purrr_0.3.4 callr_3.7.0
[29] magrittr_2.0.1 matrixStats_0.61.0 scales_1.1.1 ps_1.6.0
[33] ellipsis_0.3.2 assertthat_0.2.1 colorspace_2.0-2 utf8_1.2.2
[37] RcppParallel_5.1.4 munsell_0.5.0 crayon_1.4.2

barracuda156 avatar Dec 08 '21 07:12 barracuda156