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
Merged
Show file tree
Hide file tree
Changes from 3 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
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
- scikits.odes
- python-graphviz
95 changes: 31 additions & 64 deletions reactors/interactive_path_diagram.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 16,
"metadata": {
"tags": []
},
Expand All @@ -20,7 +20,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Using Cantera version: 2.6.0a4\n"
"Using Cantera version: 2.6.0\n"
]
}
],
Expand All @@ -29,6 +29,7 @@
"from ipywidgets import widgets, interact\n",
"import cantera as ct\n",
"import numpy as np\n",
"import graphviz\n",
"\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_formats = [\"svg\"]\n",
Expand All @@ -50,7 +51,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 5,
"metadata": {
"tags": []
},
Expand All @@ -73,7 +74,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {
"tags": []
},
Expand All @@ -91,7 +92,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 7,
"metadata": {
"tags": []
},
Expand All @@ -109,7 +110,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 8,
"metadata": {
"tags": []
},
Expand All @@ -130,7 +131,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -158,18 +159,18 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e73efe770a6a424aab889d76a70ea2d4",
"model_id": "e9eb8420e3d1441d8dacca916d65ccea",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(IntSlider(value=100, description='plot_step', max=1510, step=10), FloatSlider(value=0.1,…"
"interactive(children=(IntSlider(value=100, description='plot_step', max=1730, step=10), FloatSlider(value=0.1,…"
]
},
"metadata": {},
Expand Down Expand Up @@ -200,12 +201,8 @@
" diagram.threshold = threshold\n",
"\n",
" diagram.show_details = details\n",
" dot_file = \"reaction_paths.dot\"\n",
" png_file = \"reaction_paths.png\"\n",
" diagram.write_dot(dot_file)\n",
" subprocess.run(f\"dot {dot_file} -Tpng -o{png_file} -Gdpi=100\".split())\n",
" img = Image(filename=png_file)\n",
" display(img)"
" graph = graphviz.Source(diagram.get_dot())\n",
" display(graph)"
]
},
{
Expand All @@ -218,7 +215,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {
"tags": []
},
Expand All @@ -240,7 +237,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -274,24 +271,9 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f389251a70744d52b493b85eae3e909f",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.01, description='annotation_cutoff', max=4.0, min=0.01), Output()), …"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"@interact(\n",
" annotation_cutoff=widgets.FloatSlider(value=1e-2, min=1e-2, max=4, steps=10),\n",
Expand Down Expand Up @@ -348,7 +330,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {
"tags": []
},
Expand All @@ -374,24 +356,9 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8a6a58db99d7422790a30e3f448189c2",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatLogSlider(value=1e-05, description='annotation_cutoff', max=-4.0, min=-5.0), Output…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"@interact(\n",
" annotation_cutoff=widgets.FloatLogSlider(\n",
Expand Down Expand Up @@ -437,7 +404,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.8.12"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down Expand Up @@ -528,9 +495,9 @@
"description": "annotation_cutoff",
"layout": "IPY_MODEL_b31e0f2f2acb403b83a084fb18495310",
"max": 0.0001,
"min": 1e-06,
"min": 0.000001,
"step": 0.1,
"value": 1e-06
"value": 0.000001
}
},
"11d4490fa73f470fa12134bdbe95172f": {
Expand Down Expand Up @@ -791,9 +758,9 @@
"description": "annotation_cutoff",
"layout": "IPY_MODEL_cebcfa314a17448385e00d23be4e1132",
"max": 0.0001,
"min": 1e-06,
"min": 0.000001,
"step": 0.1,
"value": 1e-06
"value": 0.000001
}
},
"549874ce98c54398bdb34b108c543913": {
Expand Down Expand Up @@ -941,9 +908,9 @@
"description": "annotation_cutoff",
"layout": "IPY_MODEL_410cc700779545278ab29d6bdb515078",
"max": 0.0001,
"min": 1e-06,
"min": 0.000001,
"step": 0.1,
"value": 1e-06
"value": 0.000001
}
},
"6c48772d2156460e98f2d2e53d19ce7d": {
Expand All @@ -956,9 +923,9 @@
"description": "annotation_cutoff",
"layout": "IPY_MODEL_d46402fffd6243a58b1eab788b948adc",
"max": 0.1,
"min": 1e-05,
"min": 0.00001,
"step": 0.1,
"value": 1e-05
"value": 0.00001
}
},
"6db5fd30b2f7461ca1cc5547b1330a98": {
Expand Down Expand Up @@ -1527,9 +1494,9 @@
"description": "annotation_cutoff",
"layout": "IPY_MODEL_466f3c1486704068ac57d20e554de8cf",
"max": 0.1,
"min": 1e-05,
"min": 0.00001,
"step": 0.1,
"value": 1e-05
"value": 0.00001
}
},
"ce95d34031c1420abab17b1f372f6edc": {
Expand Down