diff --git a/.github/release_checklist.md b/.github/release_checklist.md index 11daa8ff70..4769599024 100644 --- a/.github/release_checklist.md +++ b/.github/release_checklist.md @@ -4,4 +4,4 @@ - `CITATION.cff` - `vcpkg.json` - Update CHANGELOG.md with a summary of the release -- Update jax and jaxlib to latest version in `pybamm.util.install_jax` and fix any bugs that arise +- Update jax and jaxlib to latest version in `pybamm.util` and fix any bugs that arise diff --git a/CHANGELOG.md b/CHANGELOG.md index 56d6845dad..ca46901d00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ## Bug fixes +- `PyBaMM` is now importable in `Linux` systems where `jax` is already installed ([#1874](https://github.com/pybamm-team/PyBaMM/pull/1874)) - Simulations with drive cycles now support `initial_soc` ([#1842](https://github.com/pybamm-team/PyBaMM/pull/1842)) - Fixed bug in expression tree simplification ([#1831](https://github.com/pybamm-team/PyBaMM/pull/1831)) - Solid tortuosity is now correctly calculated with Bruggeman coefficient of the respective electrode ([#1773](https://github.com/pybamm-team/PyBaMM/pull/1773)) @@ -37,7 +38,7 @@ - The `chemistry` keyword argument in `ParameterValues` has been deprecated. Use `ParameterValues(chem)` instead of `ParameterValues(chemistry=chem)` ([#1822](https://github.com/pybamm-team/PyBaMM/pull/1822)) - Raise error when trying to convert an `Interpolant` with the "pchip" interpolator to CasADI ([#1791](https://github.com/pybamm-team/PyBaMM/pull/1791)) - Raise error if `Concatenation` is used directly with `Variable` objects (`concatenation` should be used instead) ([#1789](https://github.com/pybamm-team/PyBaMM/pull/1789)) -- Made jax, jaxlib and the PyBaMM JaxSolver optional ([#1767](https://github.com/pybamm-team/PyBaMM/pull/1767)) +- Made jax, jaxlib and the PyBaMM JaxSolver optional ([#1767](https://github.com/pybamm-team/PyBaMM/pull/1767), [#1803](https://github.com/pybamm-team/PyBaMM/pull/1803)) # [v21.10](https://github.com/pybamm-team/PyBaMM/tree/v21.10) - 2021-10-31 diff --git a/examples/notebooks/Creating Models/1-an-ode-model.ipynb b/examples/notebooks/Creating Models/1-an-ode-model.ipynb index 059622aea8..a31e6e7b62 100644 --- a/examples/notebooks/Creating Models/1-an-ode-model.ipynb +++ b/examples/notebooks/Creating Models/1-an-ode-model.ipynb @@ -296,7 +296,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -310,7 +310,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.10" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/Creating Models/2-a-pde-model.ipynb b/examples/notebooks/Creating Models/2-a-pde-model.ipynb index bc0577e801..b88860e62a 100644 --- a/examples/notebooks/Creating Models/2-a-pde-model.ipynb +++ b/examples/notebooks/Creating Models/2-a-pde-model.ipynb @@ -340,7 +340,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/Creating Models/3-negative-particle-problem.ipynb b/examples/notebooks/Creating Models/3-negative-particle-problem.ipynb index 137571dc79..eab0019e27 100644 --- a/examples/notebooks/Creating Models/3-negative-particle-problem.ipynb +++ b/examples/notebooks/Creating Models/3-negative-particle-problem.ipynb @@ -362,7 +362,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/Creating Models/4-comparing-full-and-reduced-order-models.ipynb b/examples/notebooks/Creating Models/4-comparing-full-and-reduced-order-models.ipynb index d724b48cf4..e6e64f5f44 100644 --- a/examples/notebooks/Creating Models/4-comparing-full-and-reduced-order-models.ipynb +++ b/examples/notebooks/Creating Models/4-comparing-full-and-reduced-order-models.ipynb @@ -422,7 +422,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/Creating Models/5-half-cell-model.ipynb b/examples/notebooks/Creating Models/5-half-cell-model.ipynb index 542c5f9d51..3e38bd6132 100644 --- a/examples/notebooks/Creating Models/5-half-cell-model.ipynb +++ b/examples/notebooks/Creating Models/5-half-cell-model.ipynb @@ -648,7 +648,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/Creating Models/6-a-simple-SEI-model.ipynb b/examples/notebooks/Creating Models/6-a-simple-SEI-model.ipynb index ef2876027d..56c2a7008d 100644 --- a/examples/notebooks/Creating Models/6-a-simple-SEI-model.ipynb +++ b/examples/notebooks/Creating Models/6-a-simple-SEI-model.ipynb @@ -728,7 +728,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -742,7 +742,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.10" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/Getting Started/Tutorial 1 - How to run a model.ipynb b/examples/notebooks/Getting Started/Tutorial 1 - How to run a model.ipynb index 435a743ed4..5e10d1e175 100644 --- a/examples/notebooks/Getting Started/Tutorial 1 - How to run a model.ipynb +++ b/examples/notebooks/Getting Started/Tutorial 1 - How to run a model.ipynb @@ -264,7 +264,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -278,7 +278,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/Getting Started/Tutorial 2 - Compare models.ipynb b/examples/notebooks/Getting Started/Tutorial 2 - Compare models.ipynb index 69671815a6..fa0d233ab7 100644 --- a/examples/notebooks/Getting Started/Tutorial 2 - Compare models.ipynb +++ b/examples/notebooks/Getting Started/Tutorial 2 - Compare models.ipynb @@ -158,7 +158,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -172,7 +172,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/Getting Started/Tutorial 3 - Basic plotting.ipynb b/examples/notebooks/Getting Started/Tutorial 3 - Basic plotting.ipynb index 3d87a6cec5..1384c9dfa8 100644 --- a/examples/notebooks/Getting Started/Tutorial 3 - Basic plotting.ipynb +++ b/examples/notebooks/Getting Started/Tutorial 3 - Basic plotting.ipynb @@ -1072,7 +1072,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, diff --git a/examples/notebooks/Getting Started/Tutorial 4 - Setting parameter values.ipynb b/examples/notebooks/Getting Started/Tutorial 4 - Setting parameter values.ipynb index 6011ef6d8f..baa87a9102 100644 --- a/examples/notebooks/Getting Started/Tutorial 4 - Setting parameter values.ipynb +++ b/examples/notebooks/Getting Started/Tutorial 4 - Setting parameter values.ipynb @@ -728,7 +728,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/Getting Started/Tutorial 5 - Run experiments.ipynb b/examples/notebooks/Getting Started/Tutorial 5 - Run experiments.ipynb index 35eafc34a4..c60285a19b 100644 --- a/examples/notebooks/Getting Started/Tutorial 5 - Run experiments.ipynb +++ b/examples/notebooks/Getting Started/Tutorial 5 - Run experiments.ipynb @@ -213,7 +213,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -227,7 +227,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/Getting Started/Tutorial 6 - Managing simulation outputs.ipynb b/examples/notebooks/Getting Started/Tutorial 6 - Managing simulation outputs.ipynb index dfb571c4e3..22e3370be2 100644 --- a/examples/notebooks/Getting Started/Tutorial 6 - Managing simulation outputs.ipynb +++ b/examples/notebooks/Getting Started/Tutorial 6 - Managing simulation outputs.ipynb @@ -436,7 +436,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -450,7 +450,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/Getting Started/Tutorial 7 - Model options.ipynb b/examples/notebooks/Getting Started/Tutorial 7 - Model options.ipynb index bbea32259f..b913a9b5fd 100644 --- a/examples/notebooks/Getting Started/Tutorial 7 - Model options.ipynb +++ b/examples/notebooks/Getting Started/Tutorial 7 - Model options.ipynb @@ -149,7 +149,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -163,7 +163,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/Getting Started/Tutorial 8 - Solver options.ipynb b/examples/notebooks/Getting Started/Tutorial 8 - Solver options.ipynb index 3b920880d1..e439c16a93 100644 --- a/examples/notebooks/Getting Started/Tutorial 8 - Solver options.ipynb +++ b/examples/notebooks/Getting Started/Tutorial 8 - Solver options.ipynb @@ -149,7 +149,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -163,7 +163,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/Getting Started/Tutorial 9 - Changing the mesh.ipynb b/examples/notebooks/Getting Started/Tutorial 9 - Changing the mesh.ipynb index 27d1d6c720..3cc5f88ae0 100644 --- a/examples/notebooks/Getting Started/Tutorial 9 - Changing the mesh.ipynb +++ b/examples/notebooks/Getting Started/Tutorial 9 - Changing the mesh.ipynb @@ -325,7 +325,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/batch_study.ipynb b/examples/notebooks/batch_study.ipynb index 0eeea03b40..e4c266bcd3 100644 --- a/examples/notebooks/batch_study.ipynb +++ b/examples/notebooks/batch_study.ipynb @@ -639,7 +639,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/change-settings.ipynb b/examples/notebooks/change-settings.ipynb index a42b16cc80..c252e64d68 100644 --- a/examples/notebooks/change-settings.ipynb +++ b/examples/notebooks/change-settings.ipynb @@ -671,7 +671,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -685,7 +685,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/customize-quick-plot.ipynb b/examples/notebooks/customize-quick-plot.ipynb index 8b467cba29..583a56d29b 100644 --- a/examples/notebooks/customize-quick-plot.ipynb +++ b/examples/notebooks/customize-quick-plot.ipynb @@ -31,7 +31,7 @@ "metadata": {}, "outputs": [], "source": [ - "%pip install pybamm -q\n", + "%pip install pybamm -q # install PyBaMM if it is not installed\n", "import pybamm\n", "\n", "models = [pybamm.lithium_ion.SPM(), pybamm.lithium_ion.SPMe(), pybamm.lithium_ion.DFN()]\n", @@ -228,7 +228,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -242,7 +242,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.10" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/expression_tree/broadcasts.ipynb b/examples/notebooks/expression_tree/broadcasts.ipynb index 966d897b9b..398d924ca1 100644 --- a/examples/notebooks/expression_tree/broadcasts.ipynb +++ b/examples/notebooks/expression_tree/broadcasts.ipynb @@ -290,7 +290,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/expression_tree/expression-tree.ipynb b/examples/notebooks/expression_tree/expression-tree.ipynb index 79bc175a17..c5b3a9d336 100644 --- a/examples/notebooks/expression_tree/expression-tree.ipynb +++ b/examples/notebooks/expression_tree/expression-tree.ipynb @@ -255,9 +255,9 @@ ], "metadata": { "kernelspec": { - "display_name": "PyBaMM development (env)", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "pybamm-dev" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -269,9 +269,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, "nbformat_minor": 2 -} \ No newline at end of file +} diff --git a/examples/notebooks/initialize-model-with-solution.ipynb b/examples/notebooks/initialize-model-with-solution.ipynb index 05fdd8a5a0..5a2d7e1e10 100644 --- a/examples/notebooks/initialize-model-with-solution.ipynb +++ b/examples/notebooks/initialize-model-with-solution.ipynb @@ -30,7 +30,7 @@ } ], "source": [ - "%pip install pybamm -q\n", + "%pip install pybamm -q # install PyBaMM if it is not installed\n", "\n", "import pybamm\n", "import pandas as pd\n", @@ -312,7 +312,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -326,7 +326,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/DFN-with-particle-size-distributions.ipynb b/examples/notebooks/models/DFN-with-particle-size-distributions.ipynb index d2c8a39024..9d9f014d04 100644 --- a/examples/notebooks/models/DFN-with-particle-size-distributions.ipynb +++ b/examples/notebooks/models/DFN-with-particle-size-distributions.ipynb @@ -487,7 +487,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/DFN.ipynb b/examples/notebooks/models/DFN.ipynb index 8175c34858..10ca9f8b43 100644 --- a/examples/notebooks/models/DFN.ipynb +++ b/examples/notebooks/models/DFN.ipynb @@ -283,7 +283,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -297,7 +297,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.10" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/models/MPM.ipynb b/examples/notebooks/models/MPM.ipynb index 834c7d0b40..df3bbf649a 100644 --- a/examples/notebooks/models/MPM.ipynb +++ b/examples/notebooks/models/MPM.ipynb @@ -973,7 +973,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/SPM.ipynb b/examples/notebooks/models/SPM.ipynb index 36b0a17083..76b97de8ce 100644 --- a/examples/notebooks/models/SPM.ipynb +++ b/examples/notebooks/models/SPM.ipynb @@ -1199,7 +1199,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/SPMe.ipynb b/examples/notebooks/models/SPMe.ipynb index 1de6b6a08d..3cae861d27 100644 --- a/examples/notebooks/models/SPMe.ipynb +++ b/examples/notebooks/models/SPMe.ipynb @@ -258,7 +258,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -272,7 +272,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/models/Validating_mechanical_models_Enertech_DFN.ipynb b/examples/notebooks/models/Validating_mechanical_models_Enertech_DFN.ipynb index 1229d09341..2b52254c66 100644 --- a/examples/notebooks/models/Validating_mechanical_models_Enertech_DFN.ipynb +++ b/examples/notebooks/models/Validating_mechanical_models_Enertech_DFN.ipynb @@ -337,7 +337,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/compare-comsol-discharge-curve.ipynb b/examples/notebooks/models/compare-comsol-discharge-curve.ipynb index 4987acc5ef..131927bdd1 100644 --- a/examples/notebooks/models/compare-comsol-discharge-curve.ipynb +++ b/examples/notebooks/models/compare-comsol-discharge-curve.ipynb @@ -245,7 +245,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/compare-ecker-data.ipynb b/examples/notebooks/models/compare-ecker-data.ipynb index f0f732e8e2..5eb8323735 100644 --- a/examples/notebooks/models/compare-ecker-data.ipynb +++ b/examples/notebooks/models/compare-ecker-data.ipynb @@ -262,7 +262,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/compare-lithium-ion.ipynb b/examples/notebooks/models/compare-lithium-ion.ipynb index 50514bea5e..d8f514e1c2 100644 --- a/examples/notebooks/models/compare-lithium-ion.ipynb +++ b/examples/notebooks/models/compare-lithium-ion.ipynb @@ -453,7 +453,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -467,7 +467,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/models/compare-particle-diffusion-models.ipynb b/examples/notebooks/models/compare-particle-diffusion-models.ipynb index f5fb780005..15b35e87c0 100644 --- a/examples/notebooks/models/compare-particle-diffusion-models.ipynb +++ b/examples/notebooks/models/compare-particle-diffusion-models.ipynb @@ -33,8 +33,7 @@ } ], "source": [ - "# install PyBaMM if it is not installed\n", - "%pip install pybamm -q\n", + "%pip install pybamm -q # install PyBaMM if it is not installed\n", "import pybamm\n", "import os\n", "import numpy as np\n", @@ -337,7 +336,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -351,7 +350,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/electrode-state-of-health.ipynb b/examples/notebooks/models/electrode-state-of-health.ipynb index 4b6ecc0ece..35e1b2709c 100644 --- a/examples/notebooks/models/electrode-state-of-health.ipynb +++ b/examples/notebooks/models/electrode-state-of-health.ipynb @@ -30,7 +30,7 @@ } ], "source": [ - "%pip install pybamm -q\n", + "%pip install pybamm -q # install PyBaMM if it is not installed\n", "import pybamm\n", "import matplotlib.pyplot as plt\n", "import numpy as np" @@ -353,7 +353,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/jelly-roll-model.ipynb b/examples/notebooks/models/jelly-roll-model.ipynb index fc9ce2d40e..10e9377ddf 100644 --- a/examples/notebooks/models/jelly-roll-model.ipynb +++ b/examples/notebooks/models/jelly-roll-model.ipynb @@ -394,7 +394,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -408,7 +408,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/models/latexify.ipynb b/examples/notebooks/models/latexify.ipynb index 604bbf5dc4..3f6b783965 100644 --- a/examples/notebooks/models/latexify.ipynb +++ b/examples/notebooks/models/latexify.ipynb @@ -306,7 +306,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -546,7 +545,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.10" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/models/lead-acid.ipynb b/examples/notebooks/models/lead-acid.ipynb index 11e21b2134..d49c570907 100644 --- a/examples/notebooks/models/lead-acid.ipynb +++ b/examples/notebooks/models/lead-acid.ipynb @@ -440,7 +440,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -454,7 +454,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/models/lithium-plating.ipynb b/examples/notebooks/models/lithium-plating.ipynb index 29b946e420..05b1211b96 100644 --- a/examples/notebooks/models/lithium-plating.ipynb +++ b/examples/notebooks/models/lithium-plating.ipynb @@ -554,7 +554,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/pouch-cell-model.ipynb b/examples/notebooks/models/pouch-cell-model.ipynb index e4560bfd03..c50be5bc15 100644 --- a/examples/notebooks/models/pouch-cell-model.ipynb +++ b/examples/notebooks/models/pouch-cell-model.ipynb @@ -816,7 +816,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -830,7 +830,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/rate-capability.ipynb b/examples/notebooks/models/rate-capability.ipynb index 58041916d0..5c1a8de411 100644 --- a/examples/notebooks/models/rate-capability.ipynb +++ b/examples/notebooks/models/rate-capability.ipynb @@ -163,7 +163,7 @@ "metadata": { "file_extension": ".py", "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -177,7 +177,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" }, "mimetype": "text/x-python", "name": "python", diff --git a/examples/notebooks/models/simulating-ORegan-2021-parameter-set.ipynb b/examples/notebooks/models/simulating-ORegan-2021-parameter-set.ipynb index b1ce095e5b..31cea602c0 100644 --- a/examples/notebooks/models/simulating-ORegan-2021-parameter-set.ipynb +++ b/examples/notebooks/models/simulating-ORegan-2021-parameter-set.ipynb @@ -177,7 +177,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/submodel_cracking_DFN_or_SPM.ipynb b/examples/notebooks/models/submodel_cracking_DFN_or_SPM.ipynb index f0425407ed..0b05a112f7 100644 --- a/examples/notebooks/models/submodel_cracking_DFN_or_SPM.ipynb +++ b/examples/notebooks/models/submodel_cracking_DFN_or_SPM.ipynb @@ -273,7 +273,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/submodel_loss_of_active_materials.ipynb b/examples/notebooks/models/submodel_loss_of_active_materials.ipynb index 737707aa02..46b8bbff87 100644 --- a/examples/notebooks/models/submodel_loss_of_active_materials.ipynb +++ b/examples/notebooks/models/submodel_loss_of_active_materials.ipynb @@ -418,7 +418,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/thermal-models.ipynb b/examples/notebooks/models/thermal-models.ipynb index 46f2ac85a9..9a9b692d11 100644 --- a/examples/notebooks/models/thermal-models.ipynb +++ b/examples/notebooks/models/thermal-models.ipynb @@ -491,7 +491,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/unsteady-heat-equation.ipynb b/examples/notebooks/models/unsteady-heat-equation.ipynb index eeeb9b1bf2..257142a8ab 100644 --- a/examples/notebooks/models/unsteady-heat-equation.ipynb +++ b/examples/notebooks/models/unsteady-heat-equation.ipynb @@ -447,7 +447,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -461,7 +461,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/models/using-model-options_thermal-example.ipynb b/examples/notebooks/models/using-model-options_thermal-example.ipynb index 8db67a8054..bce6ebac71 100644 --- a/examples/notebooks/models/using-model-options_thermal-example.ipynb +++ b/examples/notebooks/models/using-model-options_thermal-example.ipynb @@ -210,7 +210,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/models/using-submodels.ipynb b/examples/notebooks/models/using-submodels.ipynb index 13d5d1a422..4deb7bb72c 100644 --- a/examples/notebooks/models/using-submodels.ipynb +++ b/examples/notebooks/models/using-submodels.ipynb @@ -606,7 +606,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/parameterization/change-input-current.ipynb b/examples/notebooks/parameterization/change-input-current.ipynb index 767d950ccb..44c17514cf 100644 --- a/examples/notebooks/parameterization/change-input-current.ipynb +++ b/examples/notebooks/parameterization/change-input-current.ipynb @@ -337,7 +337,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -351,7 +351,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/parameterization/parameter-management.ipynb b/examples/notebooks/parameterization/parameter-management.ipynb index 0db49f0372..84a9ef3791 100644 --- a/examples/notebooks/parameterization/parameter-management.ipynb +++ b/examples/notebooks/parameterization/parameter-management.ipynb @@ -414,7 +414,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -428,7 +428,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/parameterization/parameter-values.ipynb b/examples/notebooks/parameterization/parameter-values.ipynb index 7a029638ba..f20c0a2d11 100644 --- a/examples/notebooks/parameterization/parameter-values.ipynb +++ b/examples/notebooks/parameterization/parameter-values.ipynb @@ -526,7 +526,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/parameterization/parameterization.ipynb b/examples/notebooks/parameterization/parameterization.ipynb index 03c3c9cd1f..ce90d9e6e7 100644 --- a/examples/notebooks/parameterization/parameterization.ipynb +++ b/examples/notebooks/parameterization/parameterization.ipynb @@ -2474,7 +2474,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/simulating-long-experiments.ipynb b/examples/notebooks/simulating-long-experiments.ipynb index bc5a9ca168..d8855ca4f7 100644 --- a/examples/notebooks/simulating-long-experiments.ipynb +++ b/examples/notebooks/simulating-long-experiments.ipynb @@ -31,7 +31,7 @@ } ], "source": [ - "%pip install pybamm -q\n", + "%pip install pybamm -q # install PyBaMM if it is not installed\n", "import pybamm\n", "import matplotlib.pyplot as plt\n", "import numpy as np" @@ -2481,7 +2481,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/simulation-class.ipynb b/examples/notebooks/simulation-class.ipynb index 1dc1face18..f9ba35ae1e 100644 --- a/examples/notebooks/simulation-class.ipynb +++ b/examples/notebooks/simulation-class.ipynb @@ -357,7 +357,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, diff --git a/examples/notebooks/solution-data-and-processed-variables.ipynb b/examples/notebooks/solution-data-and-processed-variables.ipynb index 3a3657d5be..d6d0d2d938 100644 --- a/examples/notebooks/solution-data-and-processed-variables.ipynb +++ b/examples/notebooks/solution-data-and-processed-variables.ipynb @@ -514,7 +514,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -528,7 +528,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/solvers/dae-solver.ipynb b/examples/notebooks/solvers/dae-solver.ipynb index a2906eb74e..b639f2a94c 100644 --- a/examples/notebooks/solvers/dae-solver.ipynb +++ b/examples/notebooks/solvers/dae-solver.ipynb @@ -23,7 +23,6 @@ } ], "source": [ - "# Setup\n", "%pip install pybamm -q # install PyBaMM if it is not installed\n", "import pybamm\n", "import tests\n", @@ -329,7 +328,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -343,7 +342,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/solvers/ode-solver.ipynb b/examples/notebooks/solvers/ode-solver.ipynb index 305aa71a20..d0e7740011 100644 --- a/examples/notebooks/solvers/ode-solver.ipynb +++ b/examples/notebooks/solvers/ode-solver.ipynb @@ -23,7 +23,6 @@ } ], "source": [ - "# Setup\n", "%pip install pybamm -q # install PyBaMM if it is not installed\n", "import pybamm\n", "import tests\n", @@ -301,7 +300,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -315,7 +314,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.9.0" } }, "nbformat": 4, diff --git a/examples/notebooks/solvers/speed-up-solver.ipynb b/examples/notebooks/solvers/speed-up-solver.ipynb index 059d4eb5c8..4348c06e5d 100644 --- a/examples/notebooks/solvers/speed-up-solver.ipynb +++ b/examples/notebooks/solvers/speed-up-solver.ipynb @@ -1036,7 +1036,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -1050,7 +1050,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.8" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/examples/notebooks/spatial_methods/finite-volumes.ipynb b/examples/notebooks/spatial_methods/finite-volumes.ipynb index 499faad44e..39b7f34e97 100644 --- a/examples/notebooks/spatial_methods/finite-volumes.ipynb +++ b/examples/notebooks/spatial_methods/finite-volumes.ipynb @@ -1306,7 +1306,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.9.0" }, "toc": { "base_numbering": 1, diff --git a/pybamm/__init__.py b/pybamm/__init__.py index eb514551b2..8cea57c70e 100644 --- a/pybamm/__init__.py +++ b/pybamm/__init__.py @@ -66,7 +66,7 @@ def version(formatted=False): # from .util import Timer, TimerTime, FuzzyDict from .util import root_dir, load_function, rmse, get_infinite_nested_dict, load -from .util import get_parameters_filepath, have_jax, install_jax +from .util import get_parameters_filepath, have_jax, install_jax, is_jax_compatible from .logger import logger, set_logging_level from .settings import settings from .citations import Citations, citations, print_citations diff --git a/pybamm/util.py b/pybamm/util.py index 90a06ef702..98e4b79679 100644 --- a/pybamm/util.py +++ b/pybamm/util.py @@ -15,11 +15,16 @@ import warnings from collections import defaultdict from platform import system +import pkg_resources import numpy as np import pybamm +# versions of jax and jaxlib compatible with PyBaMM +JAX_VERSION = "0.2.12" +JAXLIB_VERSION = "0.1.70" + def root_dir(): """return the root directory of the PyBaMM install directory""" @@ -343,20 +348,39 @@ def get_parameters_filepath(path): def have_jax(): - """Check if jax and jaxlib are installed""" - return (importlib.util.find_spec("jax") is not None) and ( - importlib.util.find_spec("jaxlib") is not None + """Check if jax and jaxlib are installed with the correct versions""" + return ( + (importlib.util.find_spec("jax") is not None) + and (importlib.util.find_spec("jaxlib") is not None) + and is_jax_compatible() ) -def install_jax(): - """Install jax, jaxlib""" - jax_version = "jax==0.2.12" - jaxlib_version = "jaxlib==0.1.70" +def is_jax_compatible(): + """Check if the available version of jax and jaxlib are compatible with PyBaMM""" + return ( + pkg_resources.get_distribution("jax").version == JAX_VERSION + and pkg_resources.get_distribution("jaxlib").version == JAXLIB_VERSION + ) + +def install_jax(): # pragma: no cover + """Install jax, jaxlib""" if system() == "Windows": raise NotImplementedError("Jax is not available on Windows") + elif importlib.util.find_spec("jax") is not None: + if not is_jax_compatible(): + raise ValueError( + "Jax is already installed but the installed version of jax or jaxlib is not supported by PyBaMM", # noqa: E501 + ) else: subprocess.check_call( - [sys.executable, "-m", "pip", "install", jax_version, jaxlib_version] + [ + sys.executable, + "-m", + "pip", + "install", + f"jax=={JAX_VERSION}", + f"jaxlib=={JAXLIB_VERSION}", + ] ) diff --git a/tests/unit/test_util.py b/tests/unit/test_util.py index 3fffe15be7..0cb8816b24 100644 --- a/tests/unit/test_util.py +++ b/tests/unit/test_util.py @@ -128,6 +128,11 @@ def test_get_parameters_filepath(self): path = os.path.join(package_dir, tempfile_obj.name) self.assertTrue(pybamm.get_parameters_filepath(tempfile_obj.name) == path) + def test_is_jax_compatible(self): + if pybamm.have_jax(): + compatible = pybamm.is_jax_compatible() + self.assertTrue(compatible) + class TestSearch(unittest.TestCase): def test_url_gets_to_stdout(self):