Skip to content
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

Installing sunode on Apple Silicon via Conda? #46

Open
jucor opened this issue Dec 27, 2023 · 13 comments · Fixed by conda-forge/conda-forge-pinning-feedstock#5312
Open

Comments

@jucor
Copy link

jucor commented Dec 27, 2023

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
Copy link
Author

jucor commented Dec 27, 2023

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
Copy link
Author

jucor commented Dec 27, 2023

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

jucor added a commit to jucor/conda-forge-pinning-feedstock that referenced this issue Dec 27, 2023
Following instructions on
https://conda-forge.org/blog/posts/2020-10-29-macos-arm64/ I am adding the packages `sunode` to the list of packages supporting osx-arm64 architecture, after having checked that it does compile nicely on that platform.

Fixes pymc-devs/sunode#46
@jucor
Copy link
Author

jucor commented Dec 27, 2023

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
Copy link
Contributor

maresb commented Dec 27, 2023

Thanks @jucor for taking the initiative on this!

@DrEntropy
Copy link

DrEntropy commented Dec 27, 2023

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
Copy link
Author

jucor commented Dec 27, 2023 via email

@jucor
Copy link
Author

jucor commented Dec 28, 2023

Update:

@jucor
Copy link
Author

jucor commented Dec 28, 2023

@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 conda-forge/sunode-feedstock#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
Copy link
Author

jucor commented Dec 28, 2023

@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
Copy link
Author

jucor commented Dec 28, 2023

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
Copy link
Member

Thank you for looking into this!

It sounds to me like it could be this issue? aesara-devs/aesara#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
Copy link
Member

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
Copy link
Author

jucor commented Dec 28, 2023

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants