rstanarm as part of a jamovi module
Posted: Fri Mar 14, 2025 10:57 am
Hi,
I am trying to add a rstanarm functions (mainly stan_glm and stan_glmer) to a jamovi module to provide probabilistic estimation. However, when I am trying to install (and compile) the module I get errors about rstanarm installation failing. The specific errors I get are listed below. I am running MacBook and R version 4.4.2 (2024-10-31) and jamovi version 2.6.26.
I have read that the installation script of rstanarm differs from many other in that it assumes the working directory is the root of the package directory and setting R_HOME may conflict with this - now I am unsure if jamovi jmvtools::install() sets the working directory and this could be the trouble. I hope someone could help or just tell me that using rstanarm in a jamovi module is not possible.
regards, Kari
*********
An extract of the install/compilation output on R console:
* installing *source* package ‘rstanarm’ ...
** package ‘rstanarm’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘Apple clang version 16.0.0 (clang-1600.0.26.6)’
using C++17
using SDK: ‘MacOSX15.2.sdk’
"/Applications/jamovi.app/Contents/Frameworks/R.framework/Versions/Current/Resources/bin/../bin/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/bernoulli.stan
WARNING: ignoring environment value of R_HOME
Wrote C++ file "stan_files/bernoulli.cc"
clang++ -arch x86_64 -std=gnu++17 -I"/Applications/jamovi.app/Contents/Frameworks/R.framework/Versions/Current/Resources/bin/../include" -DNDEBUG -I"../inst/include" -I"/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -DUSE_STANC3 -D_HAS_AUTO_PTR_ETC=0 -I'/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos/StanHeaders/include' -I'/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos/rstan/include' -I'/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos/BH/include' -I'/Applications/jamovi.app/Contents/Resources/modules/base/R/Rcpp/include' -I'/Applications/jamovi.app/Contents/Resources/modules/jmv/R/RcppEigen/include' -I'/Applications/jamovi.app/Contents/Resources/modules/jmv/R/RcppParallel/include' -I/opt/R/x86_64/include WARNING: ignoring environment value of R_HOME WARNING: ignoring environment value of R_HOME -I'/Applications/jamovi.app/Contents/Resources/modules/jmv/R/RcppParallel/include' -D_REENTRANT -DSTAN_THREADS -fPIC -falign-functions=64 -Wall -g -O2 -c stan_files/bernoulli.cc -o stan_files/bernoulli.o
clang++: error: no such file or directory: 'WARNING:'
clang++: error: no such file or directory: 'ignoring'
clang++: error: no such file or directory: 'environment'
clang++: error: no such file or directory: 'value'
clang++: error: no such file or directory: 'of'
clang++: error: no such file or directory: 'R_HOME'
clang++: error: no such file or directory: 'WARNING:'
clang++: error: no such file or directory: 'ignoring'
clang++: error: no such file or directory: 'environment'
clang++: error: no such file or directory: 'value'
clang++: error: no such file or directory: 'of'
clang++: error: no such file or directory: 'R_HOME'
make: *** [stan_files/bernoulli.o] Error 1
rm stan_files/bernoulli.cc
ERROR: compilation failed for package ‘rstanarm’
* removing ‘/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos/rstanarm’
The downloaded source packages are in
‘/private/var/folders/ms/71twpwbs20l3p55vxqc33g2r0000gn/T/Rtmp0g2062/downloaded_packages’
Warning message:
In utils::install.packages(c("rstanarm"), lib = "/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos", :
installation of package ‘rstanarm’ had non-zero exit status
ERROR: dependency ‘rstanarm’ is not available for package ‘glmStan’
* removing ‘/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos/glmStan’[/i]
I am trying to add a rstanarm functions (mainly stan_glm and stan_glmer) to a jamovi module to provide probabilistic estimation. However, when I am trying to install (and compile) the module I get errors about rstanarm installation failing. The specific errors I get are listed below. I am running MacBook and R version 4.4.2 (2024-10-31) and jamovi version 2.6.26.
I have read that the installation script of rstanarm differs from many other in that it assumes the working directory is the root of the package directory and setting R_HOME may conflict with this - now I am unsure if jamovi jmvtools::install() sets the working directory and this could be the trouble. I hope someone could help or just tell me that using rstanarm in a jamovi module is not possible.
regards, Kari
*********
An extract of the install/compilation output on R console:
* installing *source* package ‘rstanarm’ ...
** package ‘rstanarm’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘Apple clang version 16.0.0 (clang-1600.0.26.6)’
using C++17
using SDK: ‘MacOSX15.2.sdk’
"/Applications/jamovi.app/Contents/Frameworks/R.framework/Versions/Current/Resources/bin/../bin/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/bernoulli.stan
WARNING: ignoring environment value of R_HOME
Wrote C++ file "stan_files/bernoulli.cc"
clang++ -arch x86_64 -std=gnu++17 -I"/Applications/jamovi.app/Contents/Frameworks/R.framework/Versions/Current/Resources/bin/../include" -DNDEBUG -I"../inst/include" -I"/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -DUSE_STANC3 -D_HAS_AUTO_PTR_ETC=0 -I'/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos/StanHeaders/include' -I'/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos/rstan/include' -I'/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos/BH/include' -I'/Applications/jamovi.app/Contents/Resources/modules/base/R/Rcpp/include' -I'/Applications/jamovi.app/Contents/Resources/modules/jmv/R/RcppEigen/include' -I'/Applications/jamovi.app/Contents/Resources/modules/jmv/R/RcppParallel/include' -I/opt/R/x86_64/include WARNING: ignoring environment value of R_HOME WARNING: ignoring environment value of R_HOME -I'/Applications/jamovi.app/Contents/Resources/modules/jmv/R/RcppParallel/include' -D_REENTRANT -DSTAN_THREADS -fPIC -falign-functions=64 -Wall -g -O2 -c stan_files/bernoulli.cc -o stan_files/bernoulli.o
clang++: error: no such file or directory: 'WARNING:'
clang++: error: no such file or directory: 'ignoring'
clang++: error: no such file or directory: 'environment'
clang++: error: no such file or directory: 'value'
clang++: error: no such file or directory: 'of'
clang++: error: no such file or directory: 'R_HOME'
clang++: error: no such file or directory: 'WARNING:'
clang++: error: no such file or directory: 'ignoring'
clang++: error: no such file or directory: 'environment'
clang++: error: no such file or directory: 'value'
clang++: error: no such file or directory: 'of'
clang++: error: no such file or directory: 'R_HOME'
make: *** [stan_files/bernoulli.o] Error 1
rm stan_files/bernoulli.cc
ERROR: compilation failed for package ‘rstanarm’
* removing ‘/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos/rstanarm’
The downloaded source packages are in
‘/private/var/folders/ms/71twpwbs20l3p55vxqc33g2r0000gn/T/Rtmp0g2062/downloaded_packages’
Warning message:
In utils::install.packages(c("rstanarm"), lib = "/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos", :
installation of package ‘rstanarm’ had non-zero exit status
ERROR: dependency ‘rstanarm’ is not available for package ‘glmStan’
* removing ‘/Users/kariruohonen/Documents/jamovi_modules/glmStan/build/R4.4.1-x64-macos/glmStan’[/i]