Despite the fixes listed, all of which I’ve tried, I continue to get the following error message when attempting to run brms:
Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! In file included from :1: In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13: In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Dense:1: In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Core:82: In file included from /usr/local/clang7/include/c++/v1/new:91: In file included from /usr/local/clang7/include/c++/v1/exception:82: In file included from /usr/local/clang7/include/c++/v1/cstdlib:86: /usr/local/clang7/include/c++/v1/stdlib.h:94:15: fatal error: ‘stdlib.h’ file not found #include_next <stdlib.h> ^~~~~~~~~~ 1 error generated. make: *** [file366d7c9e81e3.o] Error 1
Error in sink(type = “output”) : invalid connection
I’m running R 4.0.1 on a Macbook Pro, latest versions of all packages/programs (eg, Catalina 10.15.5). I’ve uninstalled and reinstalled rstan dozens of times to no avail. I’ve deleted the /usr/local/clang code as well as the Makevar files. I have Xcode running.
So, my questions are:
why can’t I run this simple code using brms (fit1 <-
brm(data = d,
family = gaussian,
weight ~ 1 + height,
prior = c(prior(normal(0, 100), class = Intercept),
prior(normal(0, 100), class = b),
prior(cauchy(0, 10), class = sigma)),
chains = 4, cores = 2, iter = 2000, warmup = 1000,
seed = 2)
does rstan (or other packages, eg, XQuartz) have to be running in background?
there are numerous ways to install rstan - which is optimal?
If code needs to be added somewhere, please specify exactly where it goes.
torkar - thank you so much!! the program started to run and got farther than ever BUT I still got the following error (indecipherable to me, I’m just an epidemiologist):
Compiling the C++ model
Start sampling
starting worker pid=923 on localhost:11179 at 11:38:39.248
starting worker pid=924 on localhost:11179 at 11:38:39.249
Error in unserialize(node$con) : error reading from connection
Calls: -> slaveLoop -> makeSOCKmaster
Execution halted
Error in unserialize(node$con) : error reading from connection
Calls: -> slaveLoop -> makeSOCKmaster
Execution halted
Error in makePSOCKcluster(names = spec, …) :
Cluster setup failed. 2 of 2 workers failed to connect.
## WORKAROUND: https://github.com/rstudio/rstudio/issues/6692
## 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")) &&
Sys.info()["sysname"] == "Darwin") {
parallel:::setDefaultClusterOptions(setup_strategy = "sequential")
}%
Compiling the C++ model
recompiling to avoid crashing R session
Start sampling
starting worker pid=1260 on localhost:11179 at 11:56:16.639
starting worker pid=1261 on localhost:11179 at 11:56:16.639
Error in unserialize(node$con) : error reading from connection
Calls: → slaveLoop → makeSOCKmaster
Execution halted
Error in unserialize(node$con) : error reading from connection
Calls: → slaveLoop → makeSOCKmaster
Execution halted
Error in makePSOCKcluster(names = spec, …) :
Cluster setup failed. 2 of 2 workers failed to connect.
Sorry to keep bothering you with this but I really want to be able to use brms…
Hi.
Excuse my ignorance, but should I put the file as above (starting with echo) or the shorter one starting with if? I ran the first one and got the same message…I’ll try the second one above, starting with echo…
thanks
echo '## WORKAROUND: https://github.com/rstudio/rstudio/issues/6692
## Revert to 'sequential' setup of PSOCK cluster in RStudio Console on macOS and R 4.0.0
if (Sys.getenv("RSTUDIO") == "1" && RSTUDIO_TERM")) &&
Sys.info()["sysname"] == "Darwin") {
parallel:::setDefaultClusterOptions(setup_strategy = "sequential")
}' > ~/.Rprofile
in your terminal and press enter. Then restart RStudio, if that doesn’t work then … hmm… I think we’ll call on @bgoodri to perhaps give us some help :)
Gee, this is really fun!!
I cut and pasted but probably shouldn’t have done something: I put it in the Terminal in RStudio, which is why I probably got this error message:
Compiling the C++ model
Start sampling
Error: 3:49: unexpected string constant
3: if (Sys.getenv(“RSTUDIO”) == “1” && RSTUDIO_TERM")) &&
4: Sys.info()["
^
Execution halted
Error: 3:49: unexpected string constant
3: if (Sys.getenv(“RSTUDIO”) == “1” && RSTUDIO_TERM")) &&
4: Sys.info()["
^
Execution halted
Should I have put it in the /.Rprofile file instead? I actually did put it there as well…if that was an error, please advise. I’m use to diseased people, not my diseased ignorance of the intricacies of coding.
Sorry, forgot the last two lines of error message:
Error in makePSOCKcluster(names = spec, …) :
Cluster setup failed. 2 of 2 workers failed to connect.
okay. if it doesn’t matter that I entered that code into Terminal on RStudio (as well as in the home directory), then we need the help of Prof Ben.
I really appreciate your help - we got rid of the clang garbage and other things, so that’s progress. Your patience is greatly respected and admired.
Thanks.
I also get system error messages when I try to enter the code…
Williams-MacBook-Pro:~ williamholden$ if (Sys.getenv(“RSTUDIO”) == “1” && RSTUDIO_TERM")) &&
-bash: syntax error near unexpected token "RSTUDIO"' Williams-MacBook-Pro:~ williamholden$ Sys.info()["sysname"] == "Darwin") { -bash: syntax error near unexpected token [“sysname”]’
Williams-MacBook-Pro:~ williamholden$ parallel:::setDefaultClusterOptions(setup_strategy = “sequential”)
-bash: syntax error near unexpected token `setup_strategy’
Okay, I edited the file and reran but still got the same message:
Compiling the C++ model
Start sampling
Error: 3:49: unexpected string constant
3: if (Sys.getenv(“RSTUDIO”) == “1” && RSTUDIO_TERM")) &&
4: Sys.info()["
^
Execution halted
Error: 3:49: unexpected string constant
3: if (Sys.getenv(“RSTUDIO”) == “1” && RSTUDIO_TERM")) &&
4: Sys.info()["
^
Execution halted
Do I have to ‘clean it up’ from the RStudio terminal? Not sure how to do that…