Error in unserialize(socklist[[n]]) : error reading from connection

I’m using OS X Catalina and Windows 10 in three different computers. Last R version 4.0.2 and last RSTUDIO version 1.3.1073

I install stan following the “https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started” Vignette instructions.

I try to use the “schools.stan” example and I obtain “Error in unserialize(socklist[[n]]) : error reading from connection” in chain 2.

I try this code also:

library(rstan)
library(brms)
SEED <- 1655
set.seed(SEED)
n <- 1e4
x <- rnorm(n)
a <- 2
b <- 3
sigma <- 100
y <- a + bx + sigmarnorm(n)
fake <- data.frame(x, y)
sc<-make_stancode(y ~ x, data=fake)
sd<-make_standata(y ~ x, data=fake)
sm<-stan_model(model_code=sc)
fits<-sampling(sm, data=sd, chain=3)

And I obtain the same error in 3 different computer:2 2 with OS X and 1 with Windows
“Error in unserialize(socklist[[n]]) : error reading from connection” or crash if I change “chain=1” or core=1

Thanks in advanced

I try to use m.cores=1 or chain=1 and I obtain a R crash

Probably I’m doing somnething wrong, but as my first “shoot” I can solve it!!!

Hi Xavier,

I can help troubleshoot your Windows installation, then we can tag someone to help with the Catalina installation.

Can you run the following on your Windows machine and post the output:

Sys.getenv("PATH")
Sys.getenv("BINPREF")
readLines("~/.R/Makevars.win")
readLines("~/.Rprofile")
readLines("~/.Renviron")
devtools::session_info("rstan")

On windows 10 computer:

Sys.getenv(“PATH”)
[1] “C:\estadistica\R\bin\x64;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Acer\abFiles\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\estadistica\MiKTeX 2.9\miktex\bin\x64\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Skype\Phone\;C:\estadistica\PuTTY\;C:\Program Files (x86)\LyX 2.2\Perl\bin;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\AutoFirma\AutoFirma;C:\Users\Xavier\AppData\Local\Microsoft\WindowsApps;C:\Users\Xavier\AppData\Local\Pandoc\;”

Sys.getenv(“BINPREF”)
[1] “”

readLines(“~/.R/Makevars.win”)
[1] “”
[2] “CXX14FLAGS=-O3 -mtune=native -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2”

readLines(“~/.Rprofile”)
Error in file(con, “r”) : no se puede abrir la conexión
Además: Warning message:
In file(con, “r”) : cannot open the connection
In addition: warning message:
cannot open file ‘C:/Users/Xavier/Documents/.Rprofile’: No such file or directory

readLines(“~/.Renviron”)
Error in file(con, “r”) : cannot open the connection
In addition: warning message:
cannot open file ‘C:/Users/Xavier/Documents/.Renviron’: No such file or directory

devtools::session_info(“rstan”)

  • Session info ------------------------------------------------------------------------------------
    setting value
    version R version 4.0.2 (2020-06-22)
    os Windows 10 x64
    system x86_64, mingw32
    ui RStudio
    language (EN)
    collate Spanish_Spain.1252
    ctype Spanish_Spain.1252
    tz Europe/Paris
    date 2020-09-21

  • Packages ----------------------------------------------------------------------------------------
    ! package * version date lib source
    assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.2)
    backports 1.1.9 2020-08-24 [1] CRAN (R 4.0.2)
    BH 1.72.0-3 2020-01-08 [1] CRAN (R 4.0.0)
    callr 3.4.4 2020-09-07 [1] CRAN (R 4.0.2)
    checkmate 2.0.0 2020-02-06 [1] CRAN (R 4.0.2)
    cli 2.0.2 2020-02-28 [1] CRAN (R 4.0.2)
    colorspace 1.4-1 2019-03-18 [1] CRAN (R 4.0.2)
    crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.2)
    curl 4.3 2019-12-02 [1] CRAN (R 4.0.2)
    desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.2)
    digest 0.6.25 2020-02-23 [1] CRAN (R 4.0.2)
    ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.2)
    evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.2)
    fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.2)
    farver 2.0.3 2020-01-16 [1] CRAN (R 4.0.2)
    ggplot2 * 3.3.2 2020-06-19 [1] CRAN (R 4.0.2)
    glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2)
    gridExtra 2.3 2017-09-09 [1] CRAN (R 4.0.2)
    gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.2)
    inline 0.3.16 2020-09-06 [1] CRAN (R 4.0.2)
    isoband 0.2.2 2020-06-20 [1] CRAN (R 4.0.2)
    jsonlite 1.7.1 2020-09-07 [1] CRAN (R 4.0.2)
    labeling 0.3 2014-08-23 [1] CRAN (R 4.0.0)
    D lattice 0.20-41 2020-04-02 [1] CRAN (R 4.0.2)
    lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.2)
    loo 2.3.1 2020-07-14 [1] CRAN (R 4.0.2)
    magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.2)
    MASS 7.3-53 2020-09-09 [1] CRAN (R 4.0.2)
    D Matrix 1.2-18 2019-11-27 [1] CRAN (R 4.0.2)
    matrixStats 0.56.0 2020-03-13 [1] CRAN (R 4.0.2)
    mgcv 1.8-33 2020-08-27 [1] CRAN (R 4.0.2)
    munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.2)
    nlme 3.1-149 2020-08-23 [1] CRAN (R 4.0.2)
    pillar 1.4.6 2020-07-10 [1] CRAN (R 4.0.2)
    pkgbuild 1.1.0 2020-07-13 [1] CRAN (R 4.0.2)
    pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.2)
    pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.2)
    praise 1.0.0 2015-08-11 [1] CRAN (R 4.0.2)
    prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.2)
    processx 3.4.4 2020-09-03 [1] CRAN (R 4.0.2)
    ps 1.3.4 2020-08-11 [1] CRAN (R 4.0.2)
    R6 2.4.1 2019-11-12 [1] CRAN (R 4.0.2)
    RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 4.0.0)
    Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.0.2)
    RcppEigen 0.3.3.7.0 2019-11-16 [1] CRAN (R 4.0.2)
    D RcppParallel 5.0.2 2020-06-24 [1] CRAN (R 4.0.2)
    rlang 0.4.7 2020-07-09 [1] CRAN (R 4.0.2)
    rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.0.2)
    rstan * 2.21.2 2020-07-27 [1] CRAN (R 4.0.2)
    rstudioapi 0.11 2020-02-07 [1] CRAN (R 4.0.2)
    scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.2)
    StanHeaders * 2.21.0-6 2020-08-16 [1] CRAN (R 4.0.2)
    testthat 2.3.2 2020-03-02 [1] CRAN (R 4.0.2)
    tibble 3.0.3 2020-07-10 [1] CRAN (R 4.0.2)
    utf8 1.1.4 2018-05-24 [1] CRAN (R 4.0.2)
    V8 3.2.0 2020-06-19 [1] CRAN (R 4.0.2)
    vctrs 0.3.4 2020-08-29 [1] CRAN (R 4.0.2)
    viridisLite 0.3.0 2018-02-01 [1] CRAN (R 4.0.2)
    withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.2)

[1] C:/estadistica/R/library

D – DLL MD5 mismatch, broken installation.

Thanks! It looks like you missed a step when installing RTools4: https://cran.r-project.org/bin/windows/Rtools/

Can you run:

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

And then restart R/RStudio and try again?

writeLines(‘PATH=“{RTOOLS40_HOME}\usr\bin;{PATH}”’, con = “~/.Renviron”)
Error: ‘\u’ used without hex digits in character string starting “'PATH=”${RTOOLS40_HOME}\u"

It looks like it didn’t copy correctly, you need the double backspace before the usr and bin paths (i.e. \\usr\\bin)

1 Like

sm<-stan_model(model_code=sc)
Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/ESTADI~1/rtools40/usr/mingw_/bin/g++’ not found

fits<-sampling(sm, data=sd, chain=3)

WORKS!!!

Thanks

1 Like

Great! That warning is safe to ignore.

Let’s get someone to have a look at your Catalina installation(s) now!

@jonah This user is on Catalina with R 4.0.2 and getting Error in unserialize(socklist[[n]]) : error reading from connection when running a model

1 Like

I’ve only seen rare instances of this on Mac. I think the most recent encounter with this error on Catalina was in the thread Some models run without problems, but more complex give error: Error in unserialize(socklist[[n]]) : error reading/writing from connection - #12 by torkar. @torkar said that he was able to fix it by removing -march=native from the Makevars file (in this case Makevars and not Makevars.win):

On my Catalina setup I haven’t had problems with this so my Makevars file looks like:

CXX14FLAGS=-O3 -march=native -mtune=native 
CXX14FLAGS += -arch x86_64 -ftemplate-depth-256

but following @torkar’s recommendation you could drop -march=native and try just

CXX14FLAGS=-O3 -mtune=native 
CXX14FLAGS += -arch x86_64 -ftemplate-depth-256

You can open that file for editing using file.edit(file.path(Sys.getenv("HOME"), ".R", "Makevars")).

2 Likes

After some uninstall-install and reboot with yours recomentation WORKS in mac too!!!

THANKS!!

1 Like

Did you remove this?

yes, but then I obtained prep_call_sampler error, after that I Uninstall-install and reboot and then it works.

Thanks

Check Repository for distributing (some) stan-dev R packages | r-packages

and try

install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))

I had an old version of rstan (version 2.21.2 from CRAN), and It was showing the error.
A new version, rstan version 2.26.3 (Stan version 2.26.1), doesn’t show the error.

1 Like

Hello,
I am having the same issue as the user that originally posted this except on a MacOS Big Sur 11.1. My models were running fine this morning and then suddenly they stopped working. I’m using the map2stan() function. I’ve tried removing the stan package and installing from source, I tried deleting the MakeVars file… it seems to only fail with the model where I have a random intercept. I’ve check the code over and over again to make sure its not an error with the way I’ve specified the model and I cannot see any errors. Any help would be greatly appreciated.

Here is my:
─ Session info 🚎 🥤 😜 ────────────────────────────────────────────────────────────────────
hash: trolleybus, cup with straw, winking face with tongue

setting value
version R version 4.1.1 (2021-08-10)
os macOS Big Sur 11.1
system x86_64, darwin17.0
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/Los_Angeles
date 2021-11-02
rstudio 2021.09.0+351 Ghost Orchid (desktop)
pandoc NA

─ Packages ──────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
abind 1.4-5 2016-07-21 [1] CRAN (R 4.1.0)
agricolae * 1.3-5 2021-06-06 [1] CRAN (R 4.1.0)
AlgDesign 1.2.0 2019-11-29 [1] CRAN (R 4.1.0)
arm * 1.12-2 2021-10-15 [1] CRAN (R 4.1.0)
assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.1.0)
backports 1.3.0 2021-10-27 [1] CRAN (R 4.1.0)
base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.1.0)
boot * 1.3-28 2021-05-03 [1] CRAN (R 4.1.1)
broom * 0.7.10 2021-10-31 [1] CRAN (R 4.1.1)
cachem 1.0.6 2021-08-19 [1] CRAN (R 4.1.0)
callr 3.7.0 2021-04-20 [1] CRAN (R 4.1.0)
car * 3.0-11 2021-06-27 [1] CRAN (R 4.1.0)
carData * 3.0-4 2020-05-22 [1] CRAN (R 4.1.0)
caret * 6.0-90 2021-10-09 [1] CRAN (R 4.1.0)
cellranger 1.1.0 2016-07-27 [1] CRAN (R 4.1.0)
checkmate 2.0.0 2020-02-06 [1] CRAN (R 4.1.0)
class 7.3-19 2021-05-03 [1] CRAN (R 4.1.1)
cli 3.1.0 2021-10-27 [1] CRAN (R 4.1.0)
cluster 2.1.2 2021-04-17 [1] CRAN (R 4.1.1)
coda 0.19-4 2020-09-30 [1] CRAN (R 4.1.0)
codetools 0.2-18 2020-11-04 [1] CRAN (R 4.1.1)
colorspace 2.0-2 2021-06-24 [1] CRAN (R 4.1.0)
combinat 0.0-8 2012-10-29 [1] CRAN (R 4.1.0)
corpcor 1.6.10 2021-09-16 [1] CRAN (R 4.1.0)
corrplot * 0.90 2021-06-30 [1] CRAN (R 4.1.0)
crayon 1.4.2 2021-10-29 [1] CRAN (R 4.1.0)
curl 4.3.2 2021-06-23 [1] CRAN (R 4.1.0)
data.table 1.14.2 2021-09-27 [1] CRAN (R 4.1.0)
DBI 1.1.1 2021-01-15 [1] CRAN (R 4.1.0)
dbplyr 2.1.1 2021-04-06 [1] CRAN (R 4.1.0)
desc 1.4.0 2021-09-28 [1] CRAN (R 4.1.0)
devtools * 2.4.2 2021-06-07 [1] CRAN (R 4.1.0)
digest 0.6.28 2021-09-23 [1] CRAN (R 4.1.0)
dplyr * 1.0.7 2021-06-18 [1] CRAN (R 4.1.0)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.0)
fansi 0.5.0 2021-05-25 [1] CRAN (R 4.1.0)
fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.0)
forcats * 0.5.1 2021-01-27 [1] CRAN (R 4.1.0)
foreach 1.5.1 2020-10-15 [1] CRAN (R 4.1.0)
foreign 0.8-81 2020-12-22 [1] CRAN (R 4.1.1)
Formula * 1.2-4 2020-10-16 [1] CRAN (R 4.1.0)
fs 1.5.0 2020-07-31 [1] CRAN (R 4.1.0)
future 1.23.0 2021-10-31 [1] CRAN (R 4.1.1)
future.apply 1.8.1 2021-08-10 [1] CRAN (R 4.1.0)
generics 0.1.1 2021-10-25 [1] CRAN (R 4.1.0)
GGally * 2.1.2 2021-06-21 [1] CRAN (R 4.1.0)
ggbiplot * 0.55 2021-11-01 [1] Github (vqv/ggbiplot@7325e88)
ggfortify * 0.4.13 2021-11-01 [1] Github (sinhrks/ggfortify@4908dc0)
ggplot2 * 3.3.5 2021-06-25 [1] CRAN (R 4.1.0)
ggpubr * 0.4.0 2020-06-27 [1] CRAN (R 4.1.0)
ggsignif 0.6.3 2021-09-09 [1] CRAN (R 4.1.0)
ggvis * 0.4.7 2020-12-04 [1] CRAN (R 4.1.0)
globals 0.14.0 2020-11-22 [1] CRAN (R 4.1.0)
glue 1.4.2 2020-08-27 [1] CRAN (R 4.1.0)
gower 0.2.2 2020-06-23 [1] CRAN (R 4.1.0)
gridExtra 2.3 2017-09-09 [1] CRAN (R 4.1.0)
gtable 0.3.0 2019-03-25 [1] CRAN (R 4.1.0)
haven 2.4.3 2021-08-04 [1] CRAN (R 4.1.0)
highr 0.9 2021-04-16 [1] CRAN (R 4.1.0)
Hmisc * 4.6-0 2021-10-07 [1] CRAN (R 4.1.0)
hms 1.1.1 2021-09-26 [1] CRAN (R 4.1.0)
htmlTable 2.3.0 2021-10-12 [1] CRAN (R 4.1.0)
htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.1.0)
htmlwidgets 1.5.4 2021-09-08 [1] CRAN (R 4.1.0)
httpuv 1.6.3 2021-09-09 [1] CRAN (R 4.1.0)
httr 1.4.2 2020-07-20 [1] CRAN (R 4.1.0)
inline 0.3.19 2021-05-31 [1] CRAN (R 4.1.0)
ipred 0.9-12 2021-09-15 [1] CRAN (R 4.1.0)
iterators 1.0.13 2020-10-15 [1] CRAN (R 4.1.0)
jpeg 0.1-9 2021-07-24 [1] CRAN (R 4.1.0)
jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.1.0)
klaR 0.6-15 2020-02-19 [1] CRAN (R 4.1.0)
knitr 1.36 2021-09-29 [1] CRAN (R 4.1.0)
labelled 2.9.0 2021-10-29 [1] CRAN (R 4.1.0)
later 1.3.0 2021-08-18 [1] CRAN (R 4.1.0)
lattice * 0.20-45 2021-09-22 [1] CRAN (R 4.1.0)
latticeExtra 0.6-29 2019-12-19 [1] CRAN (R 4.1.0)
lava 1.6.10 2021-09-02 [1] CRAN (R 4.1.0)
leaps * 3.1 2020-01-16 [1] CRAN (R 4.1.0)
lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.0)
listenv 0.8.0 2019-12-05 [1] CRAN (R 4.1.0)
lme4 * 1.1-27.1 2021-06-22 [1] CRAN (R 4.1.0)
lmerTest * 3.1-3 2020-10-23 [1] CRAN (R 4.1.0)
loo 2.4.1 2020-12-09 [1] CRAN (R 4.1.0)
lubridate 1.8.0 2021-10-07 [1] CRAN (R 4.1.0)
magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.1.0)
MASS * 7.3-54 2021-05-03 [1] CRAN (R 4.1.1)
Matrix * 1.3-4 2021-06-01 [1] CRAN (R 4.1.1)
matrixStats 0.61.0 2021-09-17 [1] CRAN (R 4.1.0)
memoise 2.0.0 2021-01-26 [1] CRAN (R 4.1.0)
mgcv 1.8-36 2021-06-01 [1] CRAN (R 4.1.1)
mice * 3.13.0 2021-01-27 [1] CRAN (R 4.1.0)
mime 0.12 2021-09-28 [1] CRAN (R 4.1.0)
miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.1.0)
minqa 1.2.4 2014-10-09 [1] CRAN (R 4.1.0)
mitools * 2.4 2019-04-26 [1] CRAN (R 4.1.0)
ModelMetrics 1.2.2.2 2020-03-17 [1] CRAN (R 4.1.0)
modelr 0.1.8 2020-05-19 [1] CRAN (R 4.1.0)
MuMIn * 1.43.17 2020-04-15 [1] CRAN (R 4.1.0)
munsell 0.5.0 2018-06-12 [1] CRAN (R 4.1.0)
mvtnorm 1.1-3 2021-10-08 [1] CRAN (R 4.1.0)
naniar * 0.6.1 2021-05-14 [1] CRAN (R 4.1.0)
nlme 3.1-152 2021-02-04 [1] CRAN (R 4.1.1)
nloptr 1.2.2.2 2020-07-02 [1] CRAN (R 4.1.0)
nnet 7.3-16 2021-05-03 [1] CRAN (R 4.1.1)
numDeriv 2016.8-1.1 2019-06-06 [1] CRAN (R 4.1.0)
openxlsx * 4.2.4 2021-06-16 [1] CRAN (R 4.1.0)
parallelly 1.28.1 2021-09-09 [1] CRAN (R 4.1.0)
PerformanceAnalytics * 2.0.4 2020-02-06 [1] CRAN (R 4.1.0)
permute * 0.9-5 2019-03-12 [1] CRAN (R 4.1.0)
pillar 1.6.4 2021-10-18 [1] CRAN (R 4.1.0)
pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 4.1.0)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.0)
pkgload 1.2.3 2021-10-13 [1] CRAN (R 4.1.0)
plotrix * 3.8-2 2021-09-08 [1] CRAN (R 4.1.0)
plyr * 1.8.6 2020-03-03 [1] CRAN (R 4.1.0)
png 0.1-7 2013-12-03 [1] CRAN (R 4.1.0)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.1.0)
pROC 1.18.0 2021-09-03 [1] CRAN (R 4.1.0)
processx 3.5.2 2021-04-30 [1] CRAN (R 4.1.0)
prodlim 2019.11.13 2019-11-17 [1] CRAN (R 4.1.0)
promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.1.0)
ps 1.6.0 2021-02-28 [1] CRAN (R 4.1.0)
purrr * 0.3.4 2020-04-17 [1] CRAN (R 4.1.0)
quadprog 1.5-8 2019-11-20 [1] CRAN (R 4.1.0)
questionr 0.7.5 2021-10-06 [1] CRAN (R 4.1.0)
R6 2.5.1 2021-08-19 [1] CRAN (R 4.1.0)
RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 4.1.0)
Rcpp 1.0.7 2021-07-07 [1] CRAN (R 4.1.0)
RcppParallel 5.1.4 2021-05-04 [1] CRAN (R 4.1.0)
readr * 2.0.2 2021-09-27 [1] CRAN (R 4.1.0)
readxl 1.3.1 2019-03-13 [1] CRAN (R 4.1.0)
recipes 0.1.17 2021-09-27 [1] CRAN (R 4.1.0)
relaimpo * 2.2-6 2021-10-20 [1] CRAN (R 4.1.0)
remotes 2.4.1 2021-09-29 [1] CRAN (R 4.1.0)
reprex 2.0.1 2021-08-05 [1] CRAN (R 4.1.0)
reshape 0.8.8 2018-10-23 [1] CRAN (R 4.1.0)
reshape2 1.4.4 2020-04-09 [1] CRAN (R 4.1.0)
rethinking * 2.13 2021-11-01 [1] Github (rmcelreath/rethinking@2acf2fd)
rio 0.5.27 2021-06-21 [1] CRAN (R 4.1.0)
rlang 0.4.12 2021-10-18 [1] CRAN (R 4.1.0)
rpart 4.1-15 2019-04-12 [1] CRAN (R 4.1.1)
rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.1.0)
rstan * 2.21.2 2020-07-27 [1] CRAN (R 4.1.0)
rstatix 0.7.0 2021-02-13 [1] CRAN (R 4.1.0)
rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.0)
rvest 1.0.2 2021-10-16 [1] CRAN (R 4.1.0)
scales * 1.1.1 2020-05-11 [1] CRAN (R 4.1.0)
sessioninfo 1.2.0 2021-10-31 [1] CRAN (R 4.1.1)
shape 1.4.6 2021-05-19 [1] CRAN (R 4.1.0)
shiny 1.7.1 2021-10-02 [1] CRAN (R 4.1.0)
StanHeaders * 2.26.4 2021-10-18 [1] local
stringi 1.7.5 2021-10-04 [1] CRAN (R 4.1.0)
stringr * 1.4.0 2019-02-10 [1] CRAN (R 4.1.0)
survey * 4.1-1 2021-07-19 [1] CRAN (R 4.1.0)
survival * 3.2-11 2021-04-26 [1] CRAN (R 4.1.1)
testthat 3.1.0 2021-10-04 [1] CRAN (R 4.1.0)
tibble * 3.1.5 2021-09-30 [1] CRAN (R 4.1.0)
tidyr * 1.1.4 2021-09-27 [1] CRAN (R 4.1.0)
tidyselect 1.1.1 2021-04-30 [1] CRAN (R 4.1.0)
tidyverse * 1.3.1 2021-04-15 [1] CRAN (R 4.1.0)
timeDate 3043.102 2018-02-21 [1] CRAN (R 4.1.0)
tzdb 0.2.0 2021-10-27 [1] CRAN (R 4.1.0)
usethis * 2.1.3 2021-10-27 [1] CRAN (R 4.1.0)
utf8 1.2.2 2021-07-24 [1] CRAN (R 4.1.0)
V8 3.4.2 2021-05-01 [1] CRAN (R 4.1.0)
vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.1.0)
vegan * 2.5-7 2020-11-28 [1] CRAN (R 4.1.0)
visdat 0.5.3 2019-02-15 [1] CRAN (R 4.1.0)
withr 2.4.2 2021-04-18 [1] CRAN (R 4.1.0)
writexl * 1.4.0 2021-04-20 [1] CRAN (R 4.1.0)
xfun 0.27 2021-10-18 [1] CRAN (R 4.1.0)
xml2 1.3.2 2020-04-23 [1] CRAN (R 4.1.0)
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.1.0)
xts * 0.12.1 2020-09-09 [1] CRAN (R 4.1.0)
zip 2.2.0 2021-05-31 [1] CRAN (R 4.1.0)
zoo * 1.8-9 2021-03-09 [1] CRAN (R 4.1.0)

Do you get a more helpful error message if you run just a single chain?

with 1 chain and 2 cores R crashes. Tried with 1 core too and R crashes. (I get a pop up message saying R needs to abort, restart session).

1 Like

I have the same problem. When I run any brms code, I either get the error “Error in unserialize(socklist[[n]]) : error reading from connection” or “R session aborted”.

When I run the foollowing code, I get either “R session aborted” as well:

example(stan_model, package = “rstan”, run.dontrun = TRUE)

Session information:

R version 4.3.0 (2023-04-21)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Asia/Seoul
tzcode source: internal

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] rstan_2.21.8 ggplot2_3.4.2 StanHeaders_2.26.26

I have the same issue. Is there any fix for this? Please help

I am getting this same error message:
Error in unserialize(socklist[[n]]) : error reading from connection
when trying to run the command “brm_multiple” from the brms package. It throws the error when trying to run the model for the first (out of 30) imputed dataset. Please help.

Please see: