pymc-devs / sunode

Solve ODEs fast, with support for PyMC
https://sunode.readthedocs.io
MIT License
105 stars 10 forks source link

Installing sunode on Apple Silicon via Conda? #46

Open jucor opened 9 months ago

jucor commented 9 months ago

Hi! What is the recommended way to install Sunode on Apple Silicon via Conda, please?

It seems sundoe does not have a conda-forge package for Apple Silicon: https://anaconda.org/conda-forge/sunode does not show any osx-arm64 label, unlike e.g. pymc:

image

Thanks for any help!

jucor commented 9 months ago

So, good news: using manual build works on Apple Silicon:

git clone https://github.com/pymc-devs/sunode
cd sunode
# conda install --only-deps sunode # NOT THIS ONE: because there's no sunode package for osx-arm64
pip install -e .

So it's more a question of modifying the feedstock so conda-forge has the right label. I need to remember how I did that for other packages 😅

jucor commented 9 months ago

Ah, yes, found back how I did it in the past: https://github.com/conda-forge/conda-forge-pinning-feedstock/pull/4191 I will try to do the same for sunode, and report here.

jucor commented 9 months ago

Alright, I've added to the adequate file in conda-forge pinning, now we need to wait for it to be merged then for the bot to update conda-forge a few hours later.

maresb commented 9 months ago

Thanks @jucor for taking the initiative on this!

DrEntropy commented 9 months ago

When I try

git clone https://github.com/pymc-devs/sunode
cd sunode
pip install -e 

I get 'file not found" for sundials/sundials_types.h. If I conda install sundials, it then fails with all kinds of errors, mainly about incorrect number of arguments, which makes me wonder if I need a specific version of sundials ?

EDIT: Yeah it works if I specify sundials-5.8.0 (that was what was installed on my windows machine).
I see also that the pull request was accepted so this will be a non-issue soon :)

jucor commented 9 months ago

I believe you need version 5.8.

On Wed, Dec 27, 2023, 22:02 DrEntropy @.***> wrote:

When I try this I get 'file not found" for sundials/sundials_types.h. If I conda install sundials, it then fails with all kinds of errors, mainly about incorrect number of arguments, which makes me wonder if I need a specific version of sundials is needed?

— Reply to this email directly, view it on GitHub https://github.com/pymc-devs/sunode/issues/46#issuecomment-1870624569, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFBERI7XIVCWAM4U5MSZT3YLSEGNAVCNFSM6AAAAABBEJPXW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZQGYZDINJWHE . You are receiving this because you were mentioned.Message ID: @.***>

jucor commented 9 months ago

Update:

jucor commented 9 months ago

@maresb sorry to bother you, but you might be more familiar with the sunode build process than I am, and thus might have more sense to make sense of the failing build logs in the feedstock at https://github.com/conda-forge/sunode-feedstock/pull/26 . Would you be able to have a look, please?

Here is a link to the log of the failure: https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=850067&view=logs&j=9c5ef928-2cd6-52e5-dbe6-9d173a7d951b&t=20c71c51-4b27-578b-485d-06ade2de1d00&l=2177

jucor commented 9 months ago

@maresb Here is the exact error that shows up: https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=850067&view=logs&j=9c5ef928-2cd6-52e5-dbe6-9d173a7d951b&t=20c71c51-4b27-578b-485d-06ade2de1d00&l=878

It's an implicit narrowing casting on sizes from long to int that seems to be the problem in one module.

I'm not sure why that error appears in the CI toolchain, but not when we compile locally :/

jucor commented 9 months ago

Digging deeper, that compilation error occurs somewhere deep in some C++ code that seems dynamically compiled from the test test_nodiff_params() at this line: https://github.com/pymc-devs/sunode/blob/f1f7f79026aafcf4a57e2feebea0be74a5e89783/sunode/test_pytensor.py#L47C78-L47C78 Log of the failing call: https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=850067&view=logs&j=9c5ef928-2cd6-52e5-dbe6-9d173a7d951b&t=20c71c51-4b27-578b-485d-06ade2de1d00&l=955

aseyboldt commented 9 months ago

Thank you for looking into this!

It sounds to me like it could be this issue? https://github.com/aesara-devs/aesara/issues/127

This happens in the generated code of pytensor if I understand correctly, maybe it would be better to just add the required cast in pytensor then, instead of adding compiler flags downstream?

aseyboldt commented 9 months ago

Does anyone know what sys.platform will report in the CI? Because that's what we use to determine if we add the extra compiler flags: https://github.com/aesara-devs/aesara/pull/972/files#diff-abd6d8030e381e908a5a5bb1829e6524f4686e78f00bddfcebc134f55c762b1bL2362

jucor commented 9 months ago

@aseyboldt Excellent question! I just tried, and it turns out that this specific test fails also on my regular macOS m1, so not only just on CI! On my macOS, sys.platform is darwin. Could it be that the flags against narrowing error might not be applied when sunode compiles the pytensor code that it generated dynamically?