Issues with RMarkdown launch because of unrelated packages

I updated R to v 4.0.1 recently and started getting 'nodes disconnected' error while using 'jags.parallel' function from R2jags. On doing a brief search, I found others were facing the same issue with MacCatalina and R V v 4.0.1.

I made the following changes to my Rprofile, made it sequential as suggested here:

cl <- parallel::makeCluster(2, setup_strategy = "sequential")
If this works, you could add the following to your ~/.Rprofile until this is fixed in R/RStudio:

WORKAROUND: parallel::makeCluster() freezes RStudio on macOS with R 4.x · Issue #6692 · rstudio/rstudio · GitHub

Revert to 'sequential' setup of PSOCK cluster in RStudio Console on macOS and R 4.0.0

if (Sys.getenv("RSTUDIO") == "1" && !nzchar(Sys.getenv("RSTUDIO_TERM")) &&["sysname"] == "Darwin" && getRversion() == "4.0.0") {
parallel:::setDefaultClusterOptions(setup_strategy = "sequential")

It didn't work for me and I deleted the code from /.Rprofile.

However, since then I have been running into the following errors (pasted below) while using RMarkdown, even for the code that do not use any parallel feature and has nothing to do with the foreach, iterators packages. I have since reinstalled both R and RStudio, I have attempted both downgrading and upgrading. I am not sure where to start to get rid of this and why is the error occurring.

When I load any projects, these three packages are attached. Even after detaching, the error remains. I am able to run other packages and code after detaching the three packages, but not RMarkdown. I really appreciate any help and guidance in debugging and where to start. I am also pasting my session info below after the error.

Loading required package: foreach
Loading required package: iterators
Loading required package: utils
Error in socketConnection("localhost", port = port, server = TRUE, blocking = TRUE, :
cannot open the connection
Calls: ... makePSOCKcluster -> newPSOCKnode -> socketConnection
In addition: Warning message:
In socketConnection("localhost", port = port, server = TRUE, blocking = TRUE, :
port 11264 cannot be opened
Execution halted

R version 4.0.1 (2020-06-06)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.5

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.0/Resources/lib/libRlapack.dylib

Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding

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

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

loaded via a namespace (and not attached):

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.