Pystan3 Not compiling with conda version of clang on mac os (can't find header files)

I am trying to run the following simple code to test out my pystan installation:

import pystan
fit = pystan.StanModel(model_code="parameters {real theta;} model {theta ~ normal(0,1);}", model_name="model_name")

I get the following output:

In file included from /var/folders/pd/ty1c08q94g51b488780wp8s80000gq/T/pystan_2mhjt8vz/stanfit4model_name_c119d6069f0316b80eefa9c12c3ce343_3927306634021715441.cpp:62:
In file included from /Users/molarinr/miniconda3/envs/res/include/python3.9/Python.h:25:
/Users/molarinr/miniconda3/envs/res/bin/../include/c++/v1/stdio.h:107:15: fatal error: 'stdio.h' file not found
#include_next <stdio.h>
              ^~~~~~~~~
Stack dump:
0.	Program arguments: /Users/molarinr/miniconda3/envs/res/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/molarinr/miniconda3/envs/res/include -arch x86_64 -I/Users/molarinr/miniconda3/envs/res/include -fPIC -O2 -isystem /Users/molarinr/miniconda3/envs/res/include -arch x86_64 -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -I/var/folders/pd/ty1c08q94g51b488780wp8s80000gq/T/pystan_2mhjt8vz -I/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/pystan -I/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/pystan/stan/src -I/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/pystan/stan/lib/stan_math -I/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/pystan/stan/lib/stan_math/lib/eigen_3.3.3 -I/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0 -I/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/pystan/stan/lib/stan_math/lib/sundials_4.1.0/include -I/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/numpy/core/include -I/Users/molarinr/miniconda3/envs/res/include/python3.9 -c /var/folders/pd/ty1c08q94g51b488780wp8s80000gq/T/pystan_2mhjt8vz/stanfit4model_name_c119d6069f0316b80eefa9c12c3ce343_3927306634021715441.cpp -o /var/folders/pd/ty1c08q94g51b488780wp8s80000gq/T/pystan_2mhjt8vz/var/folders/pd/ty1c08q94g51b488780wp8s80000gq/T/pystan_2mhjt8vz/stanfit4model_name_c119d6069f0316b80eefa9c12c3ce343_3927306634021715441.o -O2 -ftemplate-depth-256 -Wno-unused-function -Wno-uninitialized -std=c++1y 
1.	/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0/boost/units/detail/static_rational_power.hpp:169:74: current parser token 'type'
2.	/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0/boost/units/detail/static_rational_power.hpp:19:1: parsing namespace 'boost'
3.	/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0/boost/units/detail/static_rational_power.hpp:21:1: parsing namespace 'boost::units'
4.	/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0/boost/units/detail/static_rational_power.hpp:26:1: parsing namespace 'boost::units::detail'
5.	/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0/boost/units/detail/static_rational_power.hpp:163:1: parsing struct/union/class body 'boost::units::detail::static_int_power_sign_impl<N, true>'
6.	/Users/molarinr/miniconda3/envs/res/lib/python3.9/site-packages/pystan/stan/lib/stan_math/lib/boost_1.69.0/boost/units/detail/static_rational_power.hpp:166:5: parsing struct/union/class body 'boost::units::detail::static_int_power_sign_impl<N, true>::apply'
0  libLLVM-10.dylib         0x0000000114d7a765 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  libLLVM-10.dylib         0x0000000114d79668 llvm::sys::RunSignalHandlers() + 248
2  libLLVM-10.dylib         0x0000000114d79d32 llvm::sys::CleanupOnSignal(unsigned long) + 210
3  libLLVM-10.dylib         0x0000000114cbd5ad CrashRecoverySignalHandler(int) + 189
4  libsystem_platform.dylib 0x00007ff804e39c1d _sigtramp + 29
5  libsystem_platform.dylib 0x00007fcfc4b24ed8 _sigtramp + 18446743900833886936
6  libclang-cpp.10.dylib    0x000000010e580eae clang::Sema::CheckTemplateArgument(clang::TemplateTypeParmDecl*, clang::TypeSourceInfo*) + 206
7  libclang-cpp.10.dylib    0x000000010e59b2dd clang::Sema::CheckTemplateTypeArgument(clang::TemplateTypeParmDecl*, clang::TemplateArgumentLoc&, llvm::SmallVectorImpl<clang::TemplateArgument>&) + 1981
8  libclang-cpp.10.dylib    0x000000010e58f9bf clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::SourceLocation, clang::TemplateArgumentListInfo&, bool, llvm::SmallVectorImpl<clang::TemplateArgument>&, bool, bool*) + 975
9  libclang-cpp.10.dylib    0x000000010e58e245 clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation, clang::TemplateArgumentListInfo&) + 741
10 libclang-cpp.10.dylib    0x000000010e00e8af clang::Sema::ActOnCXXNestedNameSpecifier(clang::Scope*, clang::CXXScopeSpec&, clang::SourceLocation, clang::OpaquePtr<clang::TemplateName>, clang::SourceLocation, clang::SourceLocation, llvm::MutableArrayRef<clang::ParsedTemplateArgument>, clang::SourceLocation, clang::SourceLocation, bool) + 1695
11 libclang-cpp.10.dylib    0x000000010d9f7592 clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&, clang::OpaquePtr<clang::QualType>, bool, bool*, bool, clang::IdentifierInfo**, bool, bool) + 1778
12 libclang-cpp.10.dylib    0x000000010da648b2 clang::Parser::TryAnnotateTypeOrScopeToken() + 194
13 libclang-cpp.10.dylib    0x000000010d9b116a clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 2298
14 libclang-cpp.10.dylib    0x000000010d9d7644 clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) + 2244
15 libclang-cpp.10.dylib    0x000000010d9da152 clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&, clang::Parser::ParsedAttributesWithRange&, clang::TypeSpecifierType, clang::Decl*) + 1874
16 libclang-cpp.10.dylib    0x000000010d9d46ca clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int, clang::Decl*) + 2378
17 libclang-cpp.10.dylib    0x000000010d9d1f7a clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) + 5402
18 libclang-cpp.10.dylib    0x000000010d9b0cb6 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 1094
19 libclang-cpp.10.dylib    0x000000010d9d7644 clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) + 2244
20 libclang-cpp.10.dylib    0x000000010da4cc4b clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) + 315
21 libclang-cpp.10.dylib    0x000000010da4c3a0 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) + 1344
22 libclang-cpp.10.dylib    0x000000010d9d6eac clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) + 300
23 libclang-cpp.10.dylib    0x000000010d9da152 clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&, clang::Parser::ParsedAttributesWithRange&, clang::TypeSpecifierType, clang::Decl*) + 1874
24 libclang-cpp.10.dylib    0x000000010d9d46ca clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int, clang::Decl*) + 2378
25 libclang-cpp.10.dylib    0x000000010d9d1f7a clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) + 5402
26 libclang-cpp.10.dylib    0x000000010d9b0cb6 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 1094
27 libclang-cpp.10.dylib    0x000000010da4ce71 clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) + 865
28 libclang-cpp.10.dylib    0x000000010da4c3a0 clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) + 1344
29 libclang-cpp.10.dylib    0x000000010da4bcbf clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) + 255
30 libclang-cpp.10.dylib    0x000000010d9b00f9 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, clang::SourceLocation*) + 745
31 libclang-cpp.10.dylib    0x000000010da5ea05 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) + 213
32 libclang-cpp.10.dylib    0x000000010d9cba39 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) + 281
33 libclang-cpp.10.dylib    0x000000010d9cb568 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) + 5992
34 libclang-cpp.10.dylib    0x000000010d9b02a6 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, clang::SourceLocation*) + 1174
35 libclang-cpp.10.dylib    0x000000010da5ea05 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) + 213
36 libclang-cpp.10.dylib    0x000000010d9cba39 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) + 281
37 libclang-cpp.10.dylib    0x000000010d9cb568 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) + 5992
38 libclang-cpp.10.dylib    0x000000010d9b02a6 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, clang::SourceLocation*) + 1174
39 libclang-cpp.10.dylib    0x000000010da5ea05 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) + 213
40 libclang-cpp.10.dylib    0x000000010d9cba39 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) + 281
41 libclang-cpp.10.dylib    0x000000010d9cb568 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) + 5992
42 libclang-cpp.10.dylib    0x000000010d9b02a6 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, clang::SourceLocation*) + 1174
43 libclang-cpp.10.dylib    0x000000010da5ea05 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) + 213
44 libclang-cpp.10.dylib    0x000000010da5d53a clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) + 1066
45 libclang-cpp.10.dylib    0x000000010d99eeed clang::ParseAST(clang::Sema&, bool, bool) + 541
46 libclang-cpp.10.dylib    0x000000010f1cbeb8 clang::FrontendAction::Execute() + 168
47 libclang-cpp.10.dylib    0x000000010f15fdc1 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1553
48 libclang-cpp.10.dylib    0x000000010f23f81e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2190
49 clang-10                 0x000000010adbce11 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 2177
50 clang-10                 0x000000010adbacd6 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) + 358
51 libclang-cpp.10.dylib    0x000000010edf70a7 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const::$_1>(long) + 23
52 libLLVM-10.dylib         0x0000000114cbd36a llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 218
53 libclang-cpp.10.dylib    0x000000010edf6434 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const + 404
54 libclang-cpp.10.dylib    0x000000010edc1021 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const + 433
55 libclang-cpp.10.dylib    0x000000010edc15dc clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) const + 140
56 libclang-cpp.10.dylib    0x000000010eddc7fc clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) + 444
57 clang-10                 0x000000010adba5ce main + 10590
58 dyld                     0x00007ff804adc310 start + 2432
clang-10: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 10.0.0 
Target: x86_64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Users/molarinr/miniconda3/envs/res/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to  and include the crash backtrace, preprocessed source, and associated run script.
clang-10: note: diagnostic msg: Error generating preprocessed source(s).

The problem seems to be that the include for the the headers is broken somehow. I am running this within a conda environment.

Additional information:
OS: macOS 13.2.1

Python version: 3.9

Pystan version: 3.6.0

Compiler:
(Conda install)
clang version 10.0.0
Target: x86_64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Users/molarinr/miniconda3/envs/res/bin

Compiler:
(System install)
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Any help with this is greatly appreciated. Thanks!

Using pip to install pystan from PyPI is the supported method of installing pystan. PyPI has precompiled wheels for your macOS system (x86-64). conda isn’t supported at this time.