Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Fix missing dependencies in notebooks #43

Merged
merged 4 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
306 changes: 160 additions & 146 deletions electrochemistry/lithium_ion_battery.ipynb

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: cantera-latest
name: cantera-latest-release
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

dependencies:
- cantera
- matplotlib
- pandas
- scipy
- seaborn
- coolprop
- python-graphviz
- ipywidgets
16,733 changes: 8,258 additions & 8,475 deletions flames/flame_speed_with_convergence_analysis.ipynb

Large diffs are not rendered by default.

2,164 changes: 1,081 additions & 1,083 deletions flames/flame_speed_with_sensitivity_analysis.ipynb

Large diffs are not rendered by default.

2,290 changes: 1,117 additions & 1,173 deletions flames/twin_premixed_flame_axisymmetric.ipynb

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions input/ck2yaml_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
" [--name=<name>]\n",
" [--extra=<filename>]\n",
" [--output=<filename>]\n",
" [--single-intermediate-temperature]\n",
" [--permissive]\n",
" [--quiet]\n",
" [--no-validate]\n",
Expand All @@ -64,9 +65,13 @@
"specified as 'input' and the surface phase input file should be specified as\n",
"'surface'.\n",
"\n",
"The '--permissive' option allows certain recoverable parsing errors (e.g.\n",
"The '--single-intermediate-temperature' option should be used with thermo data where\n",
"only a single break temperature is used and the last value in the first line of each\n",
"species thermo entry is the molecular weight instead.\n",
"\n",
"The '--permissive' option allows certain recoverable parsing errors (such as\n",
"duplicate transport data) to be ignored. The '--name=<name>' option\n",
"is used to override default phase names (i.e. 'gas').\n",
"is used to override default phase names (that is, 'gas').\n",
"\n",
"The '--extra=<filename>' option takes a YAML file as input. This option can be\n",
"used to add to the file description, or to define custom fields that are\n",
Expand Down Expand Up @@ -268,7 +273,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down
Loading