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

Fix missing dependencies in notebooks #43

Merged
merged 4 commits into from
Dec 4, 2023

Conversation

Naikless
Copy link
Contributor

Many of the jupyter examples are currently broken due to missing dependencies.
This should at least fix some of them.

This includes:
 - scipy
 - seaborn
 - coolprop
 - scikits.odes
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@Naikless Naikless force-pushed the fix-missing-dependencies-in-notebooks branch from 8e2637c to abc5b2c Compare October 29, 2023 00:15
@@ -2,7 +2,13 @@ name: cantera-latest
channels:
- cantera
- cantera/label/dev
- conda-forge
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the intention of this change. However, adding conda-forge will (I believe) result in some packages like NumPy and SciPy coming from that channel rather than the defaults. In that case, there will be an incompatibility in the compiled clib code between Cantera/Python/NumPy. There is a Cantera package on conda-forge, but we don't publish pre-releases there so I don't think that'll work for this purpose. I'm honestly not sure how to continue from here 😦

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think any of the Jupyter examples require the development version of Cantera at this point, so we could just install everything from conda-forge, dropping the cantera and cantera/label/dev channels entirely.

Copy link
Contributor Author

@Naikless Naikless Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems reasonable to me, since the Jupyter examples probably should only contain stuff that is available in the stable release without requiring the user to install the dev version if they want to reproduce the example on their own machine. I'll change environment.yaml accordingly.

As a side note/question: how serious are these incompatibilities in practice? Because I would assume mixing channels by installing cantera from the cantera channel and everything else from conda-forge is a relatively common thing to do for people that don't pay much attention to this issue (which, until today, included myself).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how serious

In the worst case, I believe they can lead to segmentation faults in the memory which cause an immediate crash of Python. More likely would be that some symbols are named differently or are placed in a different location in the binary, which would also cause errors. Here are some docs from conda-forge about it: https://conda-forge.org/docs/user/tipsandtricks.html#using-multiple-channels

Using only conda-forge as channel to avoid incompatibilities between compiled libraries.
@bryanwweber
Copy link
Member

@Naikless Thanks for updating the environment file! Can you re-run all the Notebooks with Cantera 3.0 installed from conda-forge and commit the result?

@Naikless
Copy link
Contributor Author

Naikless commented Nov 5, 2023

Ah, I should have known there is a reason why this broke in the first place:
I ran into a dependency issue with scikits.odes explained here.
One could possibly replace the solver, but that might require more effort than just a quick fix.

@Naikless
Copy link
Contributor Author

Naikless commented Nov 7, 2023

Maybe in relation to this:

I noticed that the conda-forge version of Cantera has these rather strict requirements regarding the sundials version (and other dependencies) whereas the version from the cantera channel does not. Also, when compiling cantera 3.0 from source, the default sundials version is 5.3.

Can you elaborate on the reasons for these discrepancies?

@bryanwweber
Copy link
Member

conda forge

I think this is a preference of conda-forge because we have to compile once for every version of SUNDIALS we want to support (if I understand correctly) and that would be a lot of CI time/resources

Our recipe

I think we can pick our own choice here, and it's also possible we have it mis-specified.

Submodule

We only update this infrequently, as needed. This is a version that is stable and well tested so we feel good about keeping it as the default for source builds.

@Naikless
Copy link
Contributor Author

Naikless commented Nov 7, 2023

Thanks for the details.

Would it be possible to add a Cantera 3.0 Version to the conda-forge channel that works with sundials <= 6.5? This would solve the above dependency issue.

@bryanwweber
Copy link
Member

Would it be possible to add a Cantera 3.0 Version to the conda-forge channel that works with sundials <= 6.5? This would solve the above dependency issue.

I'm not sure. Can you open an issue at https://github.com/conda-forge/cantera-feedstock? If you can find any other examples of feedstocks that support multiple versions of SUNDIALS that'd be helpful to know how to support this.

@speth
Copy link
Member

speth commented Nov 9, 2023

To keep things relatively simple, I'd suggest just ignoring the inability to run the example that's making use of scikits.odes. With the use of the SUNDIALS IDA solver for the surface PFR now available in Cantera 3.0, this example is mainly of historical interest.

@Naikless
Copy link
Contributor Author

Naikless commented Nov 9, 2023

Can you open an issue at https://github.com/conda-forge/cantera-feedstock? If you can find any other examples of feedstocks that support multiple versions of SUNDIALS that'd be helpful to know how to support this.

I just did. However, if this is a waste of resources, we can also just follow @speth suggestion, although cleaning up disfunctional examples was what initially motivated this PR. 😬

@Naikless Naikless force-pushed the fix-missing-dependencies-in-notebooks branch from da705de to 13fd0e7 Compare November 10, 2023 14:30
 - add missing dependency for ipywidgets
 - removal of scikits.odes from environment.yaml due to sundials dependency conflict.  This  prevents the
following examples from running:
  - 1D_packbed.ipynb
  - 1D_pfr_surfchem.ipynb
@bryanwweber
Copy link
Member

@speth What do you think here? It is possible to rebuild and support older SUNDIALS versions, but it N times the CI jobs for conda-forge. I suspect since this example is out-dated, we should probably just delete it anyways?

@speth
Copy link
Member

speth commented Nov 15, 2023

@speth What do you think here? It is possible to rebuild and support older SUNDIALS versions, but it N times the CI jobs for conda-forge. I suspect since this example is out-dated, we should probably just delete it anyways?

I don't think that's consistent with how conda-forge is meant to work, is it? I thought the idea was that all dependent packages should be rebuilt to support new versions of a dependency (I suppose with the core Python package being the exception), so the place where this should be resolved is in https://github.com/conda-forge/scikits.odes-feedstock. Otherwise, the number of build combinations required grows unwieldy with more than one dependency.

I'd say let's keep this as simple as possible. The work I'm doing now on Cantera/enhancements#178 will eventually eliminate this repo as a standalone entity, though any requirements to run these examples will become requirements for a full build of the documentation website, so it is important to understand any difficulties in satisfying those dependencies.

@bryanwweber
Copy link
Member

so the place where this should be resolved is in https://github.com/conda-forge/scikits.odes-feedstock

Yes, that's my understanding as well, except that in this case I believe support for SUNDIALS >6.6 needs to be added upstream in scikits.odes first.

eliminate this repo as a standalone entity

Just to be clear, you're saying that this PR should be merged as-is and we'll handle the outdated dependency in your work for Cantera/enhancements#178?

@speth
Copy link
Member

speth commented Nov 15, 2023

Just to be clear, you're saying that this PR should be merged as-is and we'll handle the outdated dependency in your work for Cantera/enhancements#178?

Yes, though I haven't looked at the re-rendered output here myself.

@speth speth merged commit 719d410 into Cantera:main Dec 4, 2023
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 this pull request may close these issues.

3 participants