rstan
rstan copied to clipboard
Problem between rstan and RcppParallel related to tbb
Please see https://github.com/RcppCore/RcppParallel/issues/135#issuecomment-716663576
This issue arises because of the patch used on Debian builds:
https://sources.debian.org/patches/r-cran-rcppparallel/5.0.2+dfsg-3/use_debian_packaged_libtbb.patch/
In particular, RcppParallel uses the system tbb library rather than the bundled version via this patch. However, rstan still assumes that tbb would be available via RcppParallel.
One simple way forward would be for rstan to allow for this path to be missing here.
Thanks for reporting. Will need to reproduce this with Docker to be able to debug it.
Hmmm... right now I cannot reproduce the issue. It actually seems to be a problem with the ubuntu RcppParallel package.
What I did is to install ubuntu 20.10 in a docker instance. Then I installed rstan from CRAN, which pulled in RcppParallel from CRAN. Now everything works. OK, pulling now the r-cran-rcppparallel package from ubuntu installs version 4.4.4. Getting now rid of the just installed RcppParallel 5.0.2 and loading RcppParalllel (the ubuntu thing), then I get warnings and things do not compile:
> library(RcppParallel)
Warning messages:
1: In fun(libname, pkgname) : TBB library not found.
2: In fun(libname, pkgname) : TBB malloc library not found.
> require(rstan)
Loading required package: rstan
Loading required package: StanHeaders
Error: package or namespace load failed for 'StanHeaders' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace 'RcppParallel' 4.4.4 is already loaded, but >= 5.0.1 is required
Failed with error: 'package 'StanHeaders' could not be loaded'
> stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}'
> mod <- stan_model(model_code = stancode, verbose = TRUE)
Error in stan_model(model_code = stancode, verbose = TRUE) :
could not find function "stan_model"
>
All in all it looks to me as if there is a problem with the ubuntu package? Their patch is possibly incomplete wrt to using the system TBB.
@wds15 Try installing the GitHub version?
Can u reproduce the issues Frank is having? If yes, how do you install which version?
Nope but I had some issues in my Apple MacBook Air with M1 arm64 and it only solved when I installed the GitHub version of RcppParallel.
Rcpp and all other packages are fine.
I filed https://github.com/stan-dev/rstan/pull/930 to help resolve this.