[R-SIG-Mac] Error when fitting a brms model, maybe associated with Catalina MacOS

Balamuta, James Joseph b@|@mut2 @end|ng |rom ||||no|@@edu
Mon Dec 16 20:33:52 CET 2019


Simon,

Thank you for the question.  The installation splash for clang7 is generic in where to place it (see attached). If done so outside of ~/.Renviron, then the option is not used. This is especially the case with RStudio, which a large target market of the macOS community is using. 

Regarding Makevars, for those who are not on R 3.6.2, there was an issue with where the headers are located on macOS Catalina. All the *FLAGS needed to be updated to use: 

-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk 

Again, this may have changed with respect to R 3.6.2, but that was the case for the earlier version on Catalina. 

Moreover, there was an ABI compatibility issue with macOS Catalina that caused Stan chains to need an override on the SHLIB_CXXLDFLAGS variable. (Many thanks to Sebastian Weber, Kevin Ushey, and Ben Goodrich for their assistance in rooting this out.)

For discussion on this issue, please see:

- https://discourse.mc-stan.org/t/dealing-with-catalina/11285
- https://discourse.mc-stan.org/t/dealing-with-catalina-ii/11802

Also, Sebastian's post to the list-serv:

https://stat.ethz.ch/pipermail/r-sig-mac/2019-November/013116.html

Best,

JJB

On 12/16/19, 1:08 PM, "Simon Urbanek" <simon.urbanek using R-project.org> wrote:

    JJB,
    
    to be honest, what surprises me is why people don't use the most straight-forward way documented very explicitly in the installer which is simply
    
    
export PATH=/usr/local/clang7/bin:$PATH
    
    I never touch Makevars as that is very error-prone and makes it impossible to use multiple R versions. CRAN is already configured correctly for those compilers so you should not need to do any manual overrides.
    
    Cheers,
    Simon
    
     
    
    > On Dec 16, 2019, at 1:37 PM, Balamuta, James Joseph <balamut2 using illinois.edu> wrote:
    > 
    > Kasper,
    > 
    > With all due respect, setting up the ~/.R/Makevars file is a key step that trips up a majority of users. Sadly, the documentation for Makevars is not beginner friendly  and is scattered across multiple manuals [1][2] with the most precise explanation being off-site [3]. Moreover, many do not know about R's startup files [4], how to modify them, or where they exist as dot files are hidden by default [5].  
    > 
    > I've toyed with many solutions over the years, including but not limited to: providing an R script to write the lines to ~/.R/Makevars, emphasizing that `file.edit()` can be used to open the configuration files, providing step-by-step guides, and so on. The most successful approach taken was to provide as much of an automated process as possible while emphasizing the steps for those who wanted more depth. 
    > 
    > Having said this, my dream is for the macOS CRAN binary to come with everything configured and setup correctly. Until that is the case or there exists a better approach, I'm more inclined to stick with the current approach I've taken especially as the macOS toolchain's stability changes on minor point releases (MAJOR.MINOR.PATCH). Again, these are made freely available to address an ever clearer need that is arising in the community. 
    > 
    > Best,
    > 
    > JJB
    > 
    > [1]: R Installation and Administration, Section 6.3.2: macOS, https://cran.r-project.org/doc/manuals/R-admin.html#macOS-packages 
    > [2]: Writing R Extensions, Section 1.2.1: Using Makevars, https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Using-Makevars
    > [3]: StackOverflow, Understanding the contents of the Makevars file in R (macros, variables, ~/.R/Makevars and pkg/src/Makevars), https://stackoverflow.com/q/43597632/1345455 
    > [4]: Initialization at Start of an R Session https://stat.ethz.ch/R-manual/R-patched/library/base/html/Startup.html 
    > [5]: How to Show Hidden Files on a Mac https://www.macrumors.com/how-to/show-hidden-files-on-a-mac/ 
    > 
    > On 12/16/19, 9:39 AM, "R-SIG-Mac on behalf of Kasper Daniel Hansen" <r-sig-mac-bounces using r-project.org on behalf of kasperdanielhansen using gmail.com> wrote:
    > 
    >    Just a comment on the macos-rtools. It seems wrong to me to set the user
    >    level ~/.R/Makevars.
    > 
    >    On Sat, Dec 14, 2019 at 9:29 PM Manuel Spínola <mspinola10 using gmail.com> wrote:
    > 
    >> Thank you very much John.
    >> 
    >> I restarted my computer, and everything looks fine now, I fitted a brms
    >> model without the error message.
    >> 
    >> Manuel
    >> 
    >> El sáb., 14 dic. 2019 a las 19:45, Fox, John (<jfox using mcmaster.ca>)
    >> escribió:
    >> 
    >>> Dear Manuel,
    >>> 
    >>> As far as I can tell, a lot of people are experiencing problems with
    >> rstan
    >>> under Catalina -- I don't use brms but rather rstan directly, and I
    >>> thrashed around quite a bit to get it work reliably (at least so far!).
    >>> 
    >>> The final bit of the puzzle for me was to modify Makevars in the .R
    >>> subdirectory of my home directory according to the instructions at <
    >>> https://discourse.mc-stan.org/t/dealing-with-catalina-ii/11802/74>.
    >> Maybe
    >>> that will work for you too. If this is in fact a generally satisfactory
    >>> solution, one would hope that it could be made more convenient for macOS
    >>> rstan users.
    >>> 
    >>> I hope this helps,
    >>> John
    >>> 
    >>>  -----------------------------
    >>>  John Fox, Professor Emeritus
    >>>  McMaster University
    >>>  Hamilton, Ontario, Canada
    >>>  Web: http::/socserv.mcmaster.ca/jfox
    >>> 
    >>>> On Dec 14, 2019, at 6:28 PM, Manuel Spínola <mspinola10 using gmail.com>
    >>> wrote:
    >>>> 
    >>>> Dear list members,
    >>>> 
    >>>> I updated everything, Catalina, Xcode, CLT, R 3.6.2, rstan from source,
    >>> and
    >>>> installed the r-macos-rtools, but I still have problems.
    >>>> 
    >>>> library(brms)
    >>>> group <- rep(c("treat", "placebo"), each = 30)
    >>>> symptom_post <- c(rnorm(30, mean = 1, sd = 2), rnorm(30, mean = 0, sd =
    >>> 1))
    >>>> dat1 <- data.frame(group, symptom_post)
    >>>> 
    >>>> fit1 <- brm(bf(symptom_post ~ group, sigma ~ group),
    >>>>           data = dat1, family = gaussian())
    >>>> 
    >>>> Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
    >>>> [1] "Error in sampler$call_sampler(args_list[[i]]) : "
    >>>> [2] "  c++ exception (unknown reason)"
    >>>> error occurred during calling the sampler; sampling not done
    >>>> 
    >>>> 
    >>>> 
    >>>> 
    >>>> 
    >>>> 
    >>>> El jue., 12 dic. 2019 a las 12:51, Balamuta, James Joseph (<
    >>>> balamut2 using illinois.edu>) escribió:
    >>>> 
    >>>>> Greetings and Salutations All,
    >>>>> 
    >>>>> Great to see the `r-macos-rtools` installer popping up! As the author
    >> of
    >>>>> it, please note that it's an unofficial (non-CRAN backed) installer
    >> that
    >>>>> seeks to automatically establish the CRAN toolchain in a friendly GUI
    >>>>> installer. We developed it to help out students in STAT 385 @ UIUC [
    >>>>> http://stat385.com/ ]  setup the correct developer environment in a
    >>>>> uniform manner as there wasn't really any prior installer packages
    >> made
    >>>>> available at the time. We're grateful for the financial support that
    >> was
    >>>>> given by Timothy Bates to sign the installer.
    >>>>> 
    >>>>> With this being said, each step the installer takes is documented
    >>> across a
    >>>>> README file, installer splash screen, and by a post.
    >>>>> 
    >>>>> README Overview:
    >>>>> 
    >> https://github.com/rmacoslib/r-macos-rtools#what-does-the-installer-do
    >>>>> Installer Splash:
    >>>>> 
    >>> 
    >> https://raw.githubusercontent.com/rmacoslib/r-macos-rtools/master/readme_img/lock_icon.png
    >>>>> Post:
    >>>>> 
    >>> 
    >> https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/
    >>>>> 
    >>>>> That said, there is also Appendix C.3 macOS of R Installation and
    >>>>> Administration [
    >>>>> https://cran.r-project.org/doc/manuals/r-release/R-admin.html#macOS ]
    >>>>> that goes over the details in greater depth.
    >>>>> 
    >>>>> For those who are worried about security, please note that we've taken
    >>>>> steps to ensure secure downloads by verifying the installer hashes
    >>> prior to
    >>>>> installing per prior remarks by Simon regarding earlier versions of
    >> the
    >>>>> installer [ see the prior discussion and my response here:
    >>>>> https://stat.ethz.ch/pipermail/r-sig-mac/2018-May/012745.html ].
    >>>>> 
    >>>>> Lastly, and perhaps more critically, please note that just using Xcode
    >>> CLI
    >>>>> is not sufficient as it does not match the prescribed compilation
    >>> toolchain
    >>>>> (clang7 with OpenMP enabled and gfortran).
    >>>>> 
    >>>>> Best,
    >>>>> 
    >>>>> JJB
    >>>>> 
    >>>>> On 12/11/19, 7:25 PM, "R-SIG-Mac on behalf of Manuel Spínola" <
    >>>>> r-sig-mac-bounces using r-project.org on behalf of mspinola10 using gmail.com>
    >>> wrote:
    >>>>> 
    >>>>>   An update.
    >>>>> 
    >>>>>   Before doing the suggested installation, I updated Catalina to
    >>> 10.5.2,
    >>>>>   Xtools to 11.3 and the Command Line Tools and it works.
    >>>>> 
    >>>>>   Manuel
    >>>>> 
    >>>>>   El mié., 11 dic. 2019 a las 16:05, Ken Beath (<ken using kjbeath.com.au
    >>> )
    >>>>>   escribió:
    >>>>> 
    >>>>>> No, it only downloads and installs the right compilers and updates
    >>>>>> Makevars and REnvirons. These are what Stan and RCpp require so you
    >>>>> could
    >>>>>> do these manually.
    >>>>>> 
    >>>>>> What it does is described at
    >>>>> https://github.com/rmacoslib/r-macos-rtools
    >>>>>> 
    >>>>>> Ken
    >>>>>> 
    >>>>>>> On 12 Dec 2019, at 1:14 am, Manuel Spínola <mspinola10 using gmail.com>
    >>>>> wrote:
    >>>>>>> 
    >>>>>>> Thank you very much to all.
    >>>>>>> 
    >>>>>>> Does Installing the macos-rtools could affect R in other ways?
    >>>>>>> 
    >>>>>>> Manuel
    >>>>>>> 
    >>>>>>> El mié., 11 dic. 2019 a las 6:56, Ken Beath (<ken using kjbeath.com.au>)
    >>>>>> escribió:
    >>>>>>> What worked for me was installing the tools using
    >>>>>> https://github.com/rmacoslib/r-macos-rtools/releases
    >>>>>>> 
    >>>>>>> and then installing rstan from source ie
    >>>>>> install.packages(“rstan”,type=“source) as suggested on one of the
    >>>>> stan
    >>>>>> forums
    >>>>>>> 
    >>>>>>> Ken
    >>>>>>> 
    >>>>>>>> On 11 Dec 2019, at 11:09 am, Manuel Spínola <
    >>>>> mspinola10 using gmail.com>
    >>>>>> wrote:
    >>>>>>>> 
    >>>>>>>> Dear list members,
    >>>>>>>> 
    >>>>>>>> When trying to fit this example from the CRAN repository fro
    >>>>> brms, I
    >>>>>> got
    >>>>>>>> the following error message after the 4th chain.  I am using R
    >>>>> 3.6.1 in
    >>>>>>>> Catalina MacOS.
    >>>>>>>> 
    >>>>>>>> 
    >>>>>>>> library(brms)
    >>>>>>>> 
    >>>>>>>> group <- rep(c("treat", "placebo"), each = 30)
    >>>>>>>> symptom_post <- c(rnorm(30, mean = 1, sd = 2), rnorm(30, mean =
    >>>>> 0, sd
    >>>>>> = 1))
    >>>>>>>> dat1 <- data.frame(group, symptom_post)
    >>>>>>>> 
    >>>>>>>> fit1 <- brm(bf(symptom_post ~ group, sigma ~ group),
    >>>>>>>>          data = dat1, family = gaussian())
    >>>>>>>> 
    >>>>>>>> 
    >>>>>>>> [1] "Error in sampler$call_sampler(args_list[[i]]) : "
    >>>>>>>> [2] "  c++ exception (unknown reason)"
    >>>>>>>> error occurred during calling the sampler; sampling not done
    >>>>>>>> 
    >>>>>>>> I think is a problem with Catalina MacOS, but I don´t know how to
    >>>>>> solve it.
    >>>>>>>> 
    >>>>>>>> Manuel
    >>>>>>>> 
    >>>>>>>> --
    >>>>>>>> *Manuel Spínola, Ph.D.*
    >>>>>>>> Instituto Internacional en Conservación y Manejo de Vida
    >>>>> Silvestre
    >>>>>>>> Universidad Nacional
    >>>>>>>> Apartado 1350-3000
    >>>>>>>> Heredia
    >>>>>>>> COSTA RICA
    >>>>>>>> mspinola using una.cr <mspinola using una.ac.cr>
    >>>>>>>> mspinola10 using gmail.com
    >>>>>>>> Teléfono: (506) 8706 - 4662
    >>>>>>>> Personal website: Lobito de río <
    >>>>>> https://sites.google.com/site/lobitoderio/>
    >>>>>>>> Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
    >>>>>>>> 
    >>>>>>>>     [[alternative HTML version deleted]]
    >>>>>>>> 
    >>>>>>>> _______________________________________________
    >>>>>>>> R-SIG-Mac mailing list
    >>>>>>>> R-SIG-Mac using r-project.org
    >>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
    >>>>>>>> 
    >>>>>>> 
    >>>>>>> 
    >>>>>>> 
    >>>>>>> --
    >>>>>>> Manuel Spínola, Ph.D.
    >>>>>>> Instituto Internacional en Conservación y Manejo de Vida Silvestre
    >>>>>>> Universidad Nacional
    >>>>>>> Apartado 1350-3000
    >>>>>>> Heredia
    >>>>>>> COSTA RICA
    >>>>>>> mspinola using una.cr
    >>>>>>> mspinola10 using gmail.com
    >>>>>>> Teléfono: (506) 8706 - 4662
    >>>>>>> Personal website: Lobito de río
    >>>>>>> Institutional website: ICOMVIS
    >>>>>> 
    >>>>>> 
    >>>>> 
    >>>>>   --
    >>>>>   *Manuel Spínola, Ph.D.*
    >>>>>   Instituto Internacional en Conservación y Manejo de Vida Silvestre
    >>>>>   Universidad Nacional
    >>>>>   Apartado 1350-3000
    >>>>>   Heredia
    >>>>>   COSTA RICA
    >>>>>   mspinola using una.cr <mspinola using una.ac.cr>
    >>>>>   mspinola10 using gmail.com
    >>>>>   Teléfono: (506) 8706 - 4662
    >>>>>   Personal website: Lobito de río <
    >>>>> https://sites.google.com/site/lobitoderio/>
    >>>>>   Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
    >>>>> 
    >>>>>       [[alternative HTML version deleted]]
    >>>>> 
    >>>>>   _______________________________________________
    >>>>>   R-SIG-Mac mailing list
    >>>>>   R-SIG-Mac using r-project.org
    >>>>>   https://stat.ethz.ch/mailman/listinfo/r-sig-mac
    >>>>> 
    >>>>> 
    >>>>> 
    >>>> 
    >>>> --
    >>>> *Manuel Spínola, Ph.D.*
    >>>> Instituto Internacional en Conservación y Manejo de Vida Silvestre
    >>>> Universidad Nacional
    >>>> Apartado 1350-3000
    >>>> Heredia
    >>>> COSTA RICA
    >>>> mspinola using una.cr <mspinola using una.ac.cr>
    >>>> mspinola10 using gmail.com
    >>>> Teléfono: (506) 8706 - 4662
    >>>> Personal website: Lobito de río <
    >>> https://sites.google.com/site/lobitoderio/>
    >>>> Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
    >>>> 
    >>>>      [[alternative HTML version deleted]]
    >>>> 
    >>>> _______________________________________________
    >>>> R-SIG-Mac mailing list
    >>>> R-SIG-Mac using r-project.org
    >>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
    >>> 
    >>> 
    >> 
    >> --
    >> *Manuel Spínola, Ph.D.*
    >> Instituto Internacional en Conservación y Manejo de Vida Silvestre
    >> Universidad Nacional
    >> Apartado 1350-3000
    >> Heredia
    >> COSTA RICA
    >> mspinola using una.cr <mspinola using una.ac.cr>
    >> mspinola10 using gmail.com
    >> Teléfono: (506) 8706 - 4662
    >> Personal website: Lobito de río <
    >> https://sites.google.com/site/lobitoderio/>
    >> Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
    >> 
    >>        [[alternative HTML version deleted]]
    >> 
    >> _______________________________________________
    >> R-SIG-Mac mailing list
    >> R-SIG-Mac using r-project.org
    >> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
    >> 
    > 
    > 
    >    -- 
    >    Best,
    >    Kasper
    > 
    >    	[[alternative HTML version deleted]]
    > 
    >    _______________________________________________
    >    R-SIG-Mac mailing list
    >    R-SIG-Mac using r-project.org
    >    https://stat.ethz.ch/mailman/listinfo/r-sig-mac
    > 
    > 
    > _______________________________________________
    > R-SIG-Mac mailing list
    > R-SIG-Mac using r-project.org
    > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
    
    


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2019-12-16 at 1.24.20 PM.png
Type: image/png
Size: 140788 bytes
Desc: Screen Shot 2019-12-16 at 1.24.20 PM.png
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20191216/7a1c828f/attachment-0001.png>


More information about the R-SIG-Mac mailing list