RStudio/RStan not showing errors/warnings on MacOS Catalina

Hey all,

I am currently running into an odd issue with RStan on MacOS Catalina. I followed the RStan installation guide found here and was able to run and produce the expected output for the 8schools example provided on the same page. Afterwards, I moved away from that example and started working on a separate model/rscript. While writing and testing the code for that model/rscript, the appropriate errors/warnings associated with what I was writing would appear when attempting to run the code.

Unfortunately, at some point while working my model/rscript, the errors/warnings stopped showing up in the console for RStudio. I attempted to run the code and, if the code is incorrect, no form of output will be produced by RStudio. When I go back to the 8schools example I got running earlier, the expected output is produced. However, if I change the Stan model code to be incorrect, the expected output is not produced and no error message will be produced. I will post screenshots to best illustrate what I mean. I have followed the advice given at this post and uninstalled R, RStudio and RStan numerous times to no avail. Does anyone have any advice on to move forward from here?


If I click the option β€œCheck on save” and then save the correct Stan model code for the 8schools example, I receive an output telling me that the code is correct. If I delete the β€œJ” on from β€œy[J]” on line 4 and make the code incorrect, I receive no response.

Using the same incorrect Stan model code, I receive no response from RStudio when attempting to run the rscript. However, when I change it back to the correct code, the correct response is output.


# clang: start
CFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXXFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CPPFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include

SHLIB_CXXLDFLAGS+=-Wl,-rpath,${R_HOME}/lib ${R_HOME}/lib/libc++abi.1.dylib
SHLIB_CXX11LDFLAGS+=-Wl,-rpath,${R_HOME}/lib ${R_HOME}/lib/libc++abi.1.dylib
SHLIB_CXX14LDFLAGS+=-Wl,-rpath,${R_HOME}/lib ${R_HOME}/lib/libc++abi.1.dylib
# clang: end
  • Output of devtools::session_info("rstan")
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.2 (2019-12-12)
 os       macOS Catalina 10.15.2      
 system   x86_64, darwin15.6.0        
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/Phoenix             
 date     2020-01-20                  

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package      * version   date       lib source        
 assertthat     0.2.1     2019-03-21 [1] CRAN (R 3.6.0)
 backports      1.1.5     2019-10-02 [1] CRAN (R 3.6.0)
 BH             1.72.0-3  2020-01-08 [1] CRAN (R 3.6.0)
 callr          3.4.0     2019-12-09 [1] CRAN (R 3.6.0)
 checkmate      1.9.4     2019-07-04 [1] CRAN (R 3.6.0)
 cli            2.0.1     2020-01-08 [1] CRAN (R 3.6.0)
 colorspace     1.4-1     2019-03-18 [1] CRAN (R 3.6.0)
 crayon         1.3.4     2017-09-16 [1] CRAN (R 3.6.0)
 desc           1.2.0     2018-05-01 [1] CRAN (R 3.6.0)
 digest         0.6.23    2019-11-23 [1] CRAN (R 3.6.0)
 ellipsis       0.3.0     2019-09-20 [1] CRAN (R 3.6.0)
 fansi          0.4.1     2020-01-08 [1] CRAN (R 3.6.0)
 farver         2.0.3     2020-01-16 [1] CRAN (R 3.6.0)
 ggplot2        3.2.1     2019-08-10 [1] CRAN (R 3.6.0)
 glue           1.3.1     2019-03-12 [1] CRAN (R 3.6.0)
 gridExtra      2.3       2017-09-09 [1] CRAN (R 3.6.0)
 gtable         0.3.0     2019-03-25 [1] CRAN (R 3.6.0)
 inline         0.3.15    2018-05-18 [1] CRAN (R 3.6.0)
 labeling       0.3       2014-08-23 [1] CRAN (R 3.6.0)
 lattice        0.20-38   2018-11-04 [1] CRAN (R 3.6.2)
 lazyeval       0.2.2     2019-03-15 [1] CRAN (R 3.6.0)
 lifecycle      0.1.0     2019-08-01 [1] CRAN (R 3.6.0)
 loo            2.2.0     2019-12-19 [1] CRAN (R 3.6.0)
 magrittr       1.5       2014-11-22 [1] CRAN (R 3.6.0)
 MASS           7.3-51.5  2019-12-20 [1] CRAN (R 3.6.0)
 Matrix         1.2-18    2019-11-27 [1] CRAN (R 3.6.2)
 matrixStats    0.55.0    2019-09-07 [1] CRAN (R 3.6.0)
 mgcv           1.8-31    2019-11-09 [1] CRAN (R 3.6.2)
 munsell        0.5.0     2018-06-12 [1] CRAN (R 3.6.0)
 nlme           3.1-143   2019-12-10 [1] CRAN (R 3.6.0)
 pillar         1.4.3     2019-12-20 [1] CRAN (R 3.6.0)
 pkgbuild       1.0.6     2019-10-09 [1] CRAN (R 3.6.0)
 pkgconfig      2.0.3     2019-09-22 [1] CRAN (R 3.6.0)
 plyr           1.8.5     2019-12-10 [1] CRAN (R 3.6.0)
 prettyunits    1.1.0     2020-01-09 [1] CRAN (R 3.6.0)
 processx       3.4.1     2019-07-18 [1] CRAN (R 3.6.0)
 ps             1.3.0     2018-12-21 [1] CRAN (R 3.6.0)
 R6             2.4.1     2019-11-12 [1] CRAN (R 3.6.0)
 RColorBrewer   1.1-2     2014-12-07 [1] CRAN (R 3.6.0)
 Rcpp           1.0.3     2019-11-08 [1] CRAN (R 3.6.0)
 RcppEigen      0.3.3.7.0 2019-11-16 [1] CRAN (R 3.6.0)
 reshape2       1.4.3     2017-12-11 [1] CRAN (R 3.6.0)
 rlang          0.4.2     2019-11-23 [1] CRAN (R 3.6.0)
 rprojroot      1.3-2     2018-01-03 [1] CRAN (R 3.6.0)
 rstan          2.19.2    2019-07-09 [1] CRAN (R 3.6.0)
 scales         1.1.0     2019-11-18 [1] CRAN (R 3.6.0)
 StanHeaders    2.21.0-1  2020-01-19 [1] CRAN (R 3.6.2)
 stringi        1.4.5     2020-01-11 [1] CRAN (R 3.6.0)
 stringr        1.4.0     2019-02-10 [1] CRAN (R 3.6.0)
 tibble         2.1.3     2019-06-06 [1] CRAN (R 3.6.0)
 utf8           1.1.4     2018-05-24 [1] CRAN (R 3.6.0)
 vctrs          0.2.1     2019-12-17 [1] CRAN (R 3.6.0)
 viridisLite    0.3.0     2018-02-01 [1] CRAN (R 3.6.0)
 withr          2.1.2     2018-03-15 [1] CRAN (R 3.6.0)
 zeallot        0.1.0     2018-01-28 [1] CRAN (R 3.6.0)

[1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library

You are going to have to do a

remove.packages("rstan")
install.packages("rstan", type = "source")

in a clean R session.

1 Like

Hey Ben,

I had tried that originally and was still running into the same issue. However, upon following the instructions at the bottom of this page, the issue is no longer present.

remotes::install_github("stan-dev/rstan", ref = "develop", 
                        subdir = "rstan/rstan", build_opts = "")

Thank you for the quick and concise response!
Matt

OK. I have no idea why that did the trick. But I’ll try to get that rstan onto CRAN after I fix a few other things.

2 Likes

Ben,

Sounds good! Also wanted to note that the original method I used for installing rstan can be found at this page.

install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE)

I’m having this problem as well, except I couldn’t solve the issue by following the above instructions. When trying to follow the above recommendation, this is what I get:

I’ve tried uninstalling and reinstalling the prettyunits package but the results are the same.