Threading in pystan

Operating System: macOS High Sierra 10.13.6
Interface Version: pyStan 2.18.0.0
Compiler/Toolkit: I’m not sure which version is the relevant one, when I open python, it says this:
“Python 3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 11:07:29)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]”
but if I call gcc -v, it says “gcc version 4.8.5 (GCC)”

I ran the example file from this page: https://pystan.readthedocs.io/en/latest/threading_support.html and got several errors that look like this:
*** set a breakpoint in malloc_error_break to debug
python(26049,0x70000e0a6000) malloc: *** error for object 0xc000000000000000: pointer being freed was not allocated
Is there any known way to fix this?

Thanks!

This is just the compiler used to compile Python.

Did you use conda to install PyStan or pip? There are some problems with conda version (this was windows though). So I would recommend pip install pystan

Make sure that you have Xcode 8 or later, earlier versions do not support thread_local.

Thanks for the quick response! I did use conda originally but I just uninstalled and reinstalled with pip and got the same issue. I have Xcode 10 so I think I should be fine on that front. Any other potential culprits?

There could also be some clash with libc++ and libstdc++

What I recommend is to create a new (clean) conda environment and try to compile model there. If this is not working, trying brew gcc / clang might help.

One can also install gcc/clang from conda and sometimes it is the easiest option.