Is this a new conda env?
Have you tried that this?
import pytensor
pytensor.config.cxx = '/usr/bin/clang++'
Is this a new conda env?
Have you tried that this?
import pytensor
pytensor.config.cxx = '/usr/bin/clang++'
Yes, new env, and have that.
Wow, so new env, you’ve followed the steps here, and none of this worked??
Yes, any idea on the error info above?
/.pytensor/compiledir_macOS-15.4-arm64-arm-64bit-arm-3.10.16-64/tmp_71um3ky/mod.cpp:496:9: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
2025-04-10 17:10:25|CRITICAL|log:182|log_lines(): 496 | V5_stride0, V5_stride1, V5_stride2,
This doesn’t look like the error we were talking about. Can you share the code and exact steps that lead to this please? Otherwise it’s hard to help out
Try adding the following block to your .pytensorrc file:
[gcc]
cxxflags = -Wno-c++11-narrowing
Sorry, I’m unable to share the exact code… the full error messages are listed above, and it happened when I called nutpie.sample().
Thanks for the suggestion, where does .pytensorrc file locate?
" Try adding the following block to your .pytensorrc file:
[gcc]
cxxflags = -Wno-c++11-narrowing
"
This works for me!! Thank you, and thanks to everyone providing help!!
I found the
import pytensor
pytensor.config.cxx = '/usr/bin/clang++'
works perfectly for me. But I also have code that I run on Mac and Linux (where I don’t have the problem) - so adding my solution below for when you are running code in Mac and Linux environments:
import platform
if platform.system() == 'Darwin': # you are on a mac, set up the correct compiler. If not, you are OK
import pytensor
pytensor.config.cxx = '/usr/bin/clang++'
Legend, this works as a good temp fix for me.
This is exactly the case where you should be setting the config via .pytensorrc
Yeap, you are right, implementing it now!
Just chiming in – I had similar clang++ flavored error on two different Intel Macs.
On one Mac, adding pytensor.config.cxx = '/usr/bin/clang++' to the script and/or the .pytensorrc file didn’t work, but reinstalling the command line tools and rolling back to python 3.10 with a fresh environment ended up working fine.
On the other Mac, none of the above options worked, but step 5 from @jessegrabowski ‘s April 9th comment, conda remove-ing everything that conda list clang turned up, did the trick.
Thanks for the help!
omg thank you so much, i used chatgpt and tried to fix this problem for like an hour, and your code just fixed it in one sec, i literally signed up a new account for this site just to say THANK YOU SO MUCH