Just chiming in here to say that I’m getting the same error. I ran into this several days ago but restarted R, and was able to get the model to run. Now I am trying again with more diffuse priors, but am once again running into the error, this time consistently. I was able to run very similar versions of the model last week.
The only thing I can think is that it is related to memory usage in someway. Previously when I restricted the number of parameters I wanted Rstan to save this seemed to resolve the issue.
I also only noticed this when updating to R 3.6.1. So that also seems like a likely suspect.
I noticed that I had set : Sys.setenv(LOCAL_CPPFLAGS = '-march=native')
When I commented this out, it all worked well.
For improved execution time, we recommend calling
Sys.setenv(LOCAL_CPPFLAGS = ‘-march=native’)
version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 6.1
year 2019
month 07
day 05
svn rev 76782
language R
version.string R version 3.6.1 (2019-07-05)
nickname Action of the Toes
But I guess @bgoodri’s answer settles the issue for good.
As a side note, I just realised it took me so long to find the Makevars file because the .R hidden folder was not indexed, and I simply thought there was no file at all.
Error in unserialize(socklist[[n]]) : error reading from connection
goes away when I delete my Makevars.win file. My CPU is:
system(‘wmic cpu get caption, deviceid, name, numberofcores’)
Caption DeviceID Name NumberOfCores
Intel64 Family 6 Model 158 Stepping 10 CPU0 Intel(R) Core™ i7-8700 CPU @ 3.20GHz 6
However, with the following Makevars.win file (replacing ‘native’ by ‘corei7’, the error also goes away and I can install rstan from source.
I was running into this issue, as well. I tried a few of the solutions highlighted in the thread, but ultimately Guoqing_Wang’s solution was what worked for me.
Unless I’m missing it, I’m not seeing an error when I run that code. I’m relatively new to stan/brms. See attached for my output, in case it’s helpful.output.txt (21.3 KB)
I tested the example code, it worked, without error.
I tried to change the chain to 1, R just stopped without any error message.
Below is the information in my ~/.R/Makevars.win:
This particular model runs fine with one chain when I remove the makevars.win file and don’t set LOCAL_CPPFLAGS to -march=native. I thought I was also getting an error on another model when I didn’t set those, but I can’t confirm. So, the problem might be related to the -march=native and / or -mtune=native, as others above have suggested. Is there any workaround (or anticipated one) for this? Those particular settings result in considerably faster estimation, so I’d prefer to use them, if possible. But, more important is that it isn’t getting an error, so that’s a good start. Thanks for your help!