rstan icon indicating copy to clipboard operation
rstan copied to clipboard

Problem running stan_model()

Open iteimouri opened this issue 6 years ago • 2 comments

Summary:

When I run stan_model('my_file.stan') I get an error saying:

Error in sink(type = "output") : invalid connection

Description:

The full error is:

running command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file7fdb2efd6cb3.cpp 2> file7fdb2efd6cb3.cpp.err.txt' had status 
1Error in compileCode(f, code, language = language, verbose = verbose) : 
Compilation ERROR, function(s)/method(s) not created! clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from <built-in>:1:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppEigen/include/Eigen/Core:82:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:90:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/exception:81:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cs
Error in sink(type = "output") : invalid connection

I am using: RStan: "2.19.1" macOS: Catalina R Version: "3.6.3" RStudio Version: "1.2.5033"

I wonder how to resolve this?

iteimouri avatar Apr 05 '20 20:04 iteimouri

I get the same error when trying to run a brms model in Stan:

Compiling the C++ model 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/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:535: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas] #pragma clang diagnostic pop ^ In file included from :1: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13: In file included from /Library/Frameworks/R.framework/Versions/ In addition: Warning messages: 1: Rows containing NAs were excluded from the model. 2: In system(cmd, intern = !verbose) : running command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB filedc3a5f8b0c33.cpp 2> filedc3a5f8b0c33.cpp.err.txt' had status 1 Error in sink(type = "output") : invalid connection

Also in macOS Catalina, R version 3.5.3

ceciliapad avatar Apr 08 '20 07:04 ceciliapad

Sorry nobody responded to this! I just noticed when going through old issues. I'm going to close this since I think all these issues are resolved by the latest releases of R and RStan, but if these issues persist let us know and we'll reopen this and help out!

jgabry avatar Sep 04 '20 20:09 jgabry