###################################################################
Operating System: Windows 10 x64, Intel i7-8850H, 64GB RAM
Rstan Version: 2.19.3
R Version: 4.0.0 (beta) and 3.6.3 and 3.6.2
Makevars:
CXXFLAGS=-O3 -Wno-unused-variable -Wno-unused-function
CXXFLAGS += -Wno-ignored-attributes -Wno-deprecated-declarations
CXXFLAGS=-O3 -Wno-unused-variable -Wno-unused-function
CXXFLAGS += -Wno-ignored-attributes -Wno-deprecated-declarations
##################################################################
It’s hard to say where this started, but Ill try to summarize everything I’ve experienced and tell you where I’m at now that has me tearing my hair out and begging for help. I am on a newish-to-me laptop teleworking from home. I work for the USGS, so my laptop has various levels of protection and lockdowns, but I am able to install software on my own. Yesterday, I tried to rerun a fairly simple set of Stan models (a pretty basic beta regression) with the goal of replicating some WAIC values. I know the Stan code works and the data is fine because I was able to successfully run this on my old laptop. Yesterday afternoon, I had been running R 3.6.2 and (I think) rstan
2.19.2. I was not able to get the model to compile or run. It gave me an error, but I did not save the error output at that time. I haven’t run any Stan models on this hand-me-down laptop, so I figured I might as well just update R and rstan
.
When I went to CRAN I saw that R 4.0.0 is out for pre-release, so I figured I’d try it out. I installed R 4.0.0 and the beta Rtools 4.0. I installed rstan following the standard instructions. I was able to get 8schools.stan to run and my model to run. I had 16 models to run from the “fullest” model down to a suite of simpler models. The “fullest” model ran fine yesterday afternoon. So I kicked off the rest for an overnight run and unplugged (my brain, not my computer) for the day.
This morning I come to look at the results and only about 10 or 11 of the models had run. The 5 or 6 that did not run where the set of “most complex” models, but still one step down in complexity from the “full” model. All I was doing however was systematically reducing the number of terms in a model matrix for the precision term of a beta regression. I had three covariates, one continuous and two indicator variables the fullest model was every term up to and including a three-way interaction. These details are probably irrelevant however.
The error message I was getting just a few sweet hours ago for the models that did not run was the Error in unserialize(socklist[[n]]) : error reading from connection
that I had run into with previous versions of R on my old laptop. Previously, and based on this thread I had resolved this problem by deleting the -march=native
and -mtune=native
lines in my Makevars.win file. However, that did not work this time. Nor did deleting my Makevars.win file entirely. Nor did running stanc()
, stan_model()
and sampling()
sequentially as somebody else suggested. Attempting run a single chain crashed R.
I chalked this up to beta software (R 4.0.0 and Rtools 4.0) and instead decided to try the last stable version of R (3.6.3). So I installed R 3.6.3 and freshly installed rstan
and dependencies again following the standard rstan install instructions. When I tried to run 8schools.stan
, I get an actual Windows error box that pops up: “The procedure entry point CAR0 could not be located in the dynamic link library. C:/Users/dhance/AppData/Local/Temp/1/Rtmp4CjXmr/file11fc40191e1a.dll” and in the R session I get the error:
Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Users/dhance/AppData/Local/Temp/1/Rtmp4CjXmr/file11fc40191e1a.dll': LoadLibrary failure: The specified procedure could not be found.
If I try it again the dll file name changes to something else, but similar. I’ve tried completely uninstalling both versions the beta version of Rtools and Rtools 3.5 and reinstalling Rtools. No dice same error. The (temp) file does exist:
file.exists('C:/Users/dhance/AppData/Local/Temp/1/Rtmp4CjXmr/file11fc389d5e5a.dll')
[1] TRUE
After cup of coffee number three, lukewarm and black, I went back to R 4.0.0 and Rtools 4.0. Now I am able to run 8schools.stan
But when I go to run the beta regression model (10 or 11 of which just ran yesterday with basically the same setup), now I get a new and different error.
hash mismatch so recompiling; make sure Stan code ends with a blank line
Error in file(con, "r") : cannot open the connection
In addition: Warning messages:
1: In system(cmd, intern = !verbose) :
running command 'C:/Users/dhance/DOCUME~1/R/R-devel/bin/x64/R CMD SHLIB file57b41d0835ed.cpp 2> file57b41d0835ed.cpp.err.txt' had status 1
2: In file(con, "r") :
cannot open file 'file57b41d0835ed.cpp.err.txt': No such file or directory
Error in sink(type = "output") : invalid connection
What in the ever-loving fluff is going on? I’m sort of out of ideas here. Please help. I’d love to get rstan
running on either version of R.
EDIT: Well this is just hilarious. Now using R 3.6.3 I am able to get the model I want to run now without errors, BUT NOT 8schools.stan
. With R 4.0.0 I can get 8schools.stan
to run, but not the model I want.