-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pytensor and blas problems on on MacOS 15 Sequoia with Apple Silicon #1005
Comments
Thanks a lot @danieltomasz for the very high quality report. @lucianopaz, do you have any thoughts regarding the BLAS selection mechanism? |
One thing I learned & might be useful - numpy 2.2 installed via pip use accelerate, numpy 2.2 installed via the same conda installs with openblas (I checked this via numpy.show_config()) I installed it in separate env just to check, bc pytensor doesnt support yet numpy >= 2.0 |
That is indeed very interesting, thanks @danieltomasz. The Conda dependency chain is:
One way to get more flexibility to help debug this is to instead use the @danieltomasz, does this give you something to experiment with? I don't have a Mac myself, so unfortunately I can't directly debug this. |
When I force
It install with success, but gives me errors (segmentation faults)
Some of those error are discussed here https://discourse.pymc.io/t/environment-not-working-anymore-on-macos/14210 |
@danieltomasz, could you please try using the |
|
Ok, so that's installing numpy with openblas. And what happens now if you try and force |
@maresb as I wrote here it install fine, but when trying to test it give segmentation error #1005 (comment) |
Also the output from numpy even if I force accelerate in conda
|
When installing only numpy with forced accelerate
I need to leave, but I might try something out of box, like if installing pytensor via "pixi" pulls accelerate (there might be something particular to my setup how conda is linking and trying different package manager tool might help), maybe someone with Apple Sillicon can replicate in meantime |
Thanks so much for all the diagnosis @danieltomasz! For when you find some more time, I wonder if lower versions of NumPy might work? For example |
Unfortunately neither pixi, nor changing pyhon version to 3.11 or asking for lower version of numpy provide accelarate libraries (it is openblas by default); When I installe numpy via pip it intalled numpy 2.2 with accelerate, but adding pytensor to this envioronment downgrade numpy to one' that is using openblas64 |
Thanks @danieltomasz for getting back to me! Are you able to find some earlier conda-forge version of numpy that works with accelerate on your system? |
hi @maresb, I think conda and numpy worked fine earlier (the latest numpy version <2 is from february) , I cannot pinpoint exact moment, but I was probably update to MacOS 15 that changed things ~ 2 weeks ago (also recently I think that conda might changed clang compiler that it uses with the python it ships, but I am not sure about this); what could be worth to see :
|
It is just my intuition, but forcing blas to accelerate works, but it creates the create error when running due to problems with compilers on MacOS 15, but it works with openblas Also there was updates to accelerate in MacOS 15 https://developer.apple.com/documentation/accelerate/blas/ and this discussion might be relevant conda-forge/blas-feedstock#103 and here conda-forge/numpy-feedstock#253 |
Quick update: when I install via pip
numpy seems to use
is below
I am now on MacOS 15.1 |
@danieltomasz, the phrase import logging
logger = logging.getLogger("pytensor.link.c.cmodule")
logger.setLevel(logging.DEBUG)
import pytensor After the last import, you should see all of the detailed logs from I would like to see what errors pytensor is running into when it tries to determine the |
The environment wasn't completely clean, but I uninstalled
Output from pytensor
And in the same session
|
Thanks @danieltomasz , the logs say that we couldn’t find a blas library in the search directories. I can think of a couple of dumb causes but I’ll have to ask you to run a couple of other tests.
|
Hi @lucianopaz, thanks for all the comments!
Regarding 2 and 3
accelerate was installed but with the following error happens #1005 (comment) this happens also with the newer version of the miniconda Regarding 4, in the pyenv installed cpython:
Would be great if any other person on Apple processor can confirm it, if this is pecular to my setup or something more general (I started to have this problem after update to MacOS 15, MacOS 15 ships accelerate with blas 3.11, I wonder if this might be a problem |
That last thing that you tried means that we could add those flags as a check and Mac would link to Accelerate. I'll open a small patch PR so that you can try it out. |
@danieltomasz, try this PR out. It should set |
@lucianopaz seems promising
|
but with the above flag results of
are defaulting to the error I posted above
Results of
|
Awesome @danieltomasz! I can reproduce that problem locally now. The latest commit to the PR I had mentioned before should have fixed it. Let me know if it works for you. If it did, I'll try to setup a test on Mac ARM in our CI matrix so that this can be verified. |
Thanks @lucianopaz, everything seems to work ok now with cpython and pip install!
and
|
@danieltomasz, this should now be fixed with #1056. If you want, you can try to run from the current pytensor main branch and check if it works. I had to do a bunch of extra changes to ensure compilation actually used blas symbols. |
nice, after running
flags are different now
And the time of running is shorter (down to around 10-13s from 14-16s)
|
Yes, I changed the flags to make them aligned with what other blas flag specs that we use. And the execution time should be shorter because it’s actually linking to accelerate now. Before, it was failing to do so because of things that were handing downstream. |
Describe the issue:
Since update to MacOS 15 I have a problem with using Apple implementation of BLAS.
Installing
pytensor
fromminiconda3-3.12-24.7.1-0
viaconda create -n voxel-bayes-3.12 -c conda-forge pytensor
seems to installopenblas
instead of accelerate.Running this the check
And when I try to run the same command but in env with pip installed pytensor results in this
When I try to specify the accelerate the old way via "libblas=*=*accelerate" when installing the conda environment, when I try to run this it fails , I copied the output here https://discourse.pymc.io/t/pytensor-support-to-apple-accelerate-blas-with-conda-forge-on-macos-15/15131/2
Reproducable code example:
Error message:
No response
PyTensor version information:
conda-forge/osx-arm64::pytensor-2.25.4-py312h3f593ad_0
Context for the issue:
No response
The text was updated successfully, but these errors were encountered: