I have used Stan for a few years and have been able to install it on past machines with no isuues. I have a new computer and I installed everything new yesterday (Windows, R, Rstudio, and rstan).
Everything seemed to work fine based on the setup instructions but I got error message below when I ran the first example.
It seems there are quite a few users experiencing issues with Windows 10. If anyone experienced the same error below, what was there solution to getting a proper installation? In other words, does anyone have any suggestions on the best approach?
Error in file(con, ârâ) : cannot open the connection
In addition: Warning messages:
1: In file.remove(c(unprocessed, processed)) :
cannot remove file âC:\Users\szuni\AppData\Local\Temp\Rtmpe04QOB\file534c5d945a2a.stanâ, reason âNo such file or directoryâ
2: In system(cmd, intern = !verbose) :
running command âC:/R-40~1.2/bin/x64/R CMD SHLIB file534c174af0.cpp 2> file534c174af0.cpp.err.txtâ had status 1
3: In file(con, ârâ) :
cannot open file âfile534c174af0.cpp.err.txtâ: No such file or directory
Error in sink(type = âoutputâ) : invalid connection
I have a similar problem with the installation of rstan and R 4.02.
I have followed your suggestions but I still have an error message when compiling a model (see below).
This error can be obtained with the schools.stan example provided on the âRStan-Getting-Startedâ webpage.
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! C:/Users/Rno/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section .rdata$_ZTSN5boost16exception_detail19error_info_injectorISt12domain_errorEE[_ZTSN5boost16exception_detail19error_info_injectorISt12domain_errorEE]' has different size C:/Users/Rno/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section .rdata$_ZTSN5boost16exception_detail10clone_implINS0_19error_info_injectorISt12domain_errorEEEE[_ZTSN5boost16exception_detail10clone_implINS0_19error_info_injectorISt12domain_errorEEEE]â has different size
C:/Users/Rno/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTSN5boost16exception_detail19error_info_injectorISt14overflow_errorEE[_ZTSN5boost16exception_detail19error_info_injectorISt14overflow_errorEE]â has different size
C:/Users/Rno/Documents/R/win-library/4.0/rstan/lib/x
Error in sink(type = âoutputâ) : incorrect connection
My sessionInfo();
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)
Matrix products: default
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstan_2.21.2 ggplot2_3.3.2 StanHeaders_2.21.0-6
No idea. I just asked my colleague (who also recommended the march thing to drop) to try and everything samples just fine. So, @Rno, maybe you wipe out the installation and start over? Please make sure to use the dev versions as instructed in the RStan for Windows thread.
I still have the same error after reinstalling everything from scratch !
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! C:/Users/Rno/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section
`.rdata$_ZTSN5boost16exception_detail19error_info_injectorISt12domain_errorEE[_ZTSN5boost16exception_detail19error_info_injectorISt12domain_errorEE]' has different size
C:/Users/Rno/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTSN5boost16exception_detail10clone_implINS0_19error_info_injectorISt12domain_errorEEEE[_ZTSN5boost16exception_detail10clone_implINS0_19error_info_injectorISt12domain_errorEEEE]' has different size
C:/Users/Rno/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTSN5boost16exception_detail19error_info_injectorISt14overflow_errorEE[_ZTSN5boost16exception_detail19error_info_injectorISt14overflow_errorEE]' has different size
C:/Users/Rno/Documents/R/win-library/4.0/rstan/lib/x
Error in sink(type = "output") : incorrect connexionError in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! C:/Users/Rno/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTSN5boost16exception_detail19error_info_injectorISt12domain_errorEE[_ZTSN5boost16exception_detail19error_info_injectorISt12domain_errorEE]' has different size
C:/Users/Rno/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTSN5boost16exception_detail10clone_implINS0_19error_info_injectorISt12domain_errorEEEE[_ZTSN5boost16exception_detail10clone_implINS0_19error_info_injectorISt12domain_errorEEEE]' has different size
C:/Users/Rno/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTSN5boost16exception_detail19error_info_injectorISt14overflow_errorEE[_ZTSN5boost16exception_detail19error_info_injectorISt14overflow_errorEE]' has different size
C:/Users/Rno/Documents/R/win-library/4.0/rstan/lib/x
Error in sink(type = "output") : incorrect connection
Here is what I have done
brand new installation of R 4.0.2
update of Rstudio to v1.3.10.56
installation of the CRAN version of rstan (avoid the installation of every depencies one by one). Note: I used install.packages(ârstanâ, type = âsourceâ)
installation of the last versions of StanHeaders and rstan
Sorry itâs still not working. My knowledge of Windows is pretty limited, so I wonât be of much help here unfortunately. @bgoodri or @wds15 any ideas?
FYI. I had the same problem and reinstalled Rcpp from source as suggested by @bgoodri and that solved it (I also reinstalled rstan from source as well just to be safe)
I had a number of hassles getting stan working again - I havenât used it for quite a while. Here are my suggestions - buyer beware:
## Fixing:
# I have reinstalled rstan, R, Rstudio, pkgbuild, rtools.
# I have removed makevars.win, and edited makevars to remove duplicates (eg CXX14...) and remove `-march=native`
# I have removed any paths from files or deleted the files that appeared in any startup, discovered using this:
# install.packages("startup")
# startup::startup(debug = TRUE)
# Sys.getenv("PATH") #checking it has no superfluous rtools or rbuildtools or rtools 40 directories - only ones that are needed and work
Here is a laundry list of errors I had that are now fixed.
Error in withr::set_makevars(new, path, state, assignment = assignment) :
Multiple results for CXX14FLAGS found, something is wrong.FALSE
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
'C:/RBUILD~1/4.0/usr/mingw_/bin/g++' not found
WARNING: Rtools is required to build R packages, but the version of Rtools previously installed in C:/RBuildTools/4.0 has been deleted.
The only remaining error doesnât seem to be an issue
Warning messages:
1: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
'-E' not found
Above steps got the schools and rats examples working.
To get my previous more complex model working (error was error-cannot-allocate-vector-of-size-17348-7-gb, I had to delete the compiled model my_model.rds, as suggested by my new best friend Elchorro here