I’m trying to fit a brms model that previously worked fine, and get the warning
“Compiling Stan program…
The NEXT version of Stan will not be able to pre-process your Stan program.
Please open an issue at Issues · stan-dev/stanc3 · GitHub
if you can share or at least describe your Stan program. This will help ensure that Stan
continues to work on your Stan programs in the future. Thank you!
This message can be avoided by wrapping your function call inside suppressMessages().
cannot remove file ‘C:\Users\canaa\AppData\Local\Temp\RtmpgtGlUo\file962869932f4d.stan’, reason ‘No such file or directory’”
I can’t locate the specific temporary file, and have uninstalled and reinstalled r, rstudio, and rtools to the latest version. I’m on Windows 10 x64. The function then halts and throws this warning:
Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! C:/rtools40/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file96286eb28c9.o:file96286eb28c9.cpp:(.text+0xe4c): undefined reference to tbb::internal::task_scheduler_observer_v3::observe(bool)' C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file96286eb28c9.o:file96286eb28c9.cpp:(.text+0x2787): undefined reference to rstan::stan_fit::stan_fit(SEXPREC*, int)’ C:/rtools40/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file96286eb28c9.o:file96286eb28c9.cpp:(.text+0xe8e): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)’ C:/rtools40/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file96286eb28c9.o:file96286eb28c9.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D1Ev[_ZN3tbb8internal26task_scheduler_observe
Today I updated R to v.4.0.2, udated all packages, too. Now I’m getting almost identical errors as Canaan_Breiss whether I run the models directly in rstan as Stan programs or through brms. I get the following message when running one of Stan’s stan_demo() models:
The NEXT version of Stan will not be able to pre-process your Stan program.
Please open an issue at https://github.com/stan-dev/stanc3/issues
if you can share or at least describe your Stan program. This will help ensure that Stan
continues to work on your Stan programs in the future. Thank you!
This message can be avoided by wrapping your function call inside suppressMessages().
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! C:/rtools40/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file215c36107370.o:file215c36107370.cpp:(.text+0x134c): undefined reference to `rstan::stan_fit::stan_fit(SEXPREC*, int)’
<<…and so on…>>
Today I installed the latest versions of R, Rstudio, and Rtools on a Windows 10 x64 machine, and I downloaded the latest version of brms and rstan. I tried to run several models with the brm() function but unfortunately I have not been able to obtain any result.
Hi all, I am getting a similar error as the OP with a brms::brm model:
Compiling Stan program...
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! C:/Program Files/R/R-4.0.4/library/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTIN5boost10wrapexceptISt12domain_errorEE[_ZTIN5boost10wrapexceptISt12domain_errorEE]' has different size
C:/Program Files/R/R-4.0.4/library/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTIN5boost10wrapexceptISt14overflow_errorEE[_ZTIN5boost10wrapexceptISt14overflow_errorEE]' has different size
C:/Program Files/R/R-4.0.4/library/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTIN5boost10wrapexceptISt11logic_errorEE[_ZTIN5boost10wrapexceptISt11logic_errorEE]' has different size
C:/Program Files/R/R-4.0.4/library/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTIN5boost10wrapexceptINS_4math16evaluation_errorEEE[_ZTIN5boost10wrapexceptINS_4math16evaluation_errorEEE]' has different size
C:/Program Files/R/R-4.0.4/library/rstan/lib/x64/libStanServ
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
'-E' not found
Error in sink(type = "output") : invalid connection
I was having similar errors with R version 4.0.2, so I updated R, and everything else:
I have tried to look into the file that the error is referencing (libStanServices.a) to look for something that might be duplicated, but I am not familiar with the format. Also not sure if it is helpful, but Stan compiles from rstanarm without any issues. Any ideas?
The output the first time I ran it was much larger than the space in the console, but the second time was much shorter and manageable… not sure why. The output is attached.
No errors, just the warning Warning message: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) : '-E' not found
Stan seems to compile fine from rstanarm as well, but not for brms.
I apologize for the naivety - I get an error, but perhaps I am missing a step. When I just add type="source" to install.packages (see below), R can’t find ggplot2 or rstan.
install.packages(c("RcppParallel", "rstan", "StanHeaders"), type = "source")
Error in install.packages : Updating loaded packages
Loading required package: rstan
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.4.7 is already loaded, but >= 0.4.10 is required
Failed with error: ‘package ‘ggplot2’ could not be loaded’
Error in .requirePackage(package) :
unable to find required package ‘rstan’
Loading required package: rstan
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.4.7 is already loaded, but >= 0.4.10 is required
Failed with error: ‘package ‘ggplot2’ could not be loaded’
Error in .requirePackage(package) :
unable to find required package ‘rstan’
Loading required package: rstan
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.4.7 is already loaded, but >= 0.4.10 is required
Failed with error: ‘package ‘ggplot2’ could not be loaded’
Error in .requirePackage(package) :
unable to find required package ‘rstan’
Can you close and re-open R/RStudio, making sure that no packages are loaded, and run:
# Remove old packages
remove.packages(c("rstan","StanHeaders","RcppParallel"))
# Compile packages using all cores
Sys.setenv(MAKEFLAGS = paste0("-j",parallel::detectCores()))
install.packages("RcppParallel", type = "source")
install.packages("StanHeaders", type = "source")
install.packages("rstan", type = "source")
Hmm, something’s a bit off there. For now just install the RcppParallel binary (install.packages as usual), and then install rstan and StanHeaders from source