From 90bd1abf127045406a152bffa7a366bc56a23153 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 29 Aug 2025 12:38:30 -0400 Subject: [PATCH 1/5] Add contextily, allow 3.13 Tensorflow --- CHANGELOG.md | 6 +++++- install_miniforge.bash | 13 +++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ecee0b..e59fa60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,14 +11,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Update example Miniforge version to 25.3.0-3 +- Update example Miniforge version to 25.3.1-3 - Update example Python version to 3.13 - Re-enable `basemap` installation by default - This is now possible as `basemap` has been updated to support `numpy` v2 - Rename `always_circular_stereo.py` to `cartopy_example.py` +- Enable TensorFlow installation for Python 3.13 + - This is now possible as TensorFlow has been updated to support Python 3.13 ### Added +- Explicit Conda Packages + - contextily - Explicit Pip Packages - nco - cdo diff --git a/install_miniforge.bash b/install_miniforge.bash index f7475f0..a525728 100755 --- a/install_miniforge.bash +++ b/install_miniforge.bash @@ -73,7 +73,7 @@ fi # ----- EXAMPLE_PY_VERSION="3.13" -EXAMPLE_MINI_VERSION="25.3.0-3" +EXAMPLE_MINI_VERSION="25.3.1-0" EXAMPLE_INSTALLDIR="/opt/GEOSpyD" EXAMPLE_DATE=$(date +%F) usage() { @@ -603,9 +603,11 @@ $PACKAGE_INSTALL earthaccess $PACKAGE_INSTALL uxarray +$PACKAGE_INSTALL contextily + # We seem to need to require sqlite 3.48.0 *exactly* for ipython3 # NOTE: This might need to be revisited in the next version -$PACKAGE_INSTALL sqlite"==3.48.0" +#$PACKAGE_INSTALL sqlite"==3.48.0" # Only install pythran on linux. On mac it brings in an old clang if [[ $MINIFORGE_ARCH == Linux ]] @@ -653,12 +655,7 @@ $PIP_INSTALL PyRTF3 pipenv pymp-pypi rasterio h5py $PIP_INSTALL pycircleci metpy siphon questionary xgrads $PIP_INSTALL ruamel.yaml $PIP_INSTALL xgboost -# At the moment tensorflow does not support Python 3.13 -# See https://github.com/tensorflow/tensorflow/issues/78774 -if [[ $PYTHON_VER_WITHOUT_DOT -lt 313 ]] -then - $PIP_INSTALL tensorflow evidential-deep-learning silence_tensorflow -fi +$PIP_INSTALL tensorflow evidential-deep-learning silence_tensorflow $PIP_INSTALL torch $PIP_INSTALL yaplon $PIP_INSTALL lxml From d2a8894654913a44290354379ce92f307c8547ea Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 29 Aug 2025 13:35:31 -0400 Subject: [PATCH 2/5] Remove sqlite fix --- CHANGELOG.md | 3 +++ install_miniforge.bash | 4 ---- tests/torch_example.py | 45 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 tests/torch_example.py diff --git a/CHANGELOG.md b/CHANGELOG.md index e59fa60..b3b0803 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,9 +26,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Explicit Pip Packages - nco - cdo +- Add new pytorch test ### Removed +- Removed `sqlite` fix as it doesn't seem needed anymore for `ipython` + ### Deprecated ## [24.11.3] - 2025-03-03 diff --git a/install_miniforge.bash b/install_miniforge.bash index a525728..d115756 100755 --- a/install_miniforge.bash +++ b/install_miniforge.bash @@ -605,10 +605,6 @@ $PACKAGE_INSTALL uxarray $PACKAGE_INSTALL contextily -# We seem to need to require sqlite 3.48.0 *exactly* for ipython3 -# NOTE: This might need to be revisited in the next version -#$PACKAGE_INSTALL sqlite"==3.48.0" - # Only install pythran on linux. On mac it brings in an old clang if [[ $MINIFORGE_ARCH == Linux ]] then diff --git a/tests/torch_example.py b/tests/torch_example.py new file mode 100644 index 0000000..c8dbe14 --- /dev/null +++ b/tests/torch_example.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- + +import torch +import math + + +dtype = torch.float +device = torch.device("cpu") +# device = torch.device("cuda:0") # Uncomment this to run on GPU + +# Create random input and output data +x = torch.linspace(-math.pi, math.pi, 2000, device=device, dtype=dtype) +y = torch.sin(x) + +# Randomly initialize weights +a = torch.randn((), device=device, dtype=dtype) +b = torch.randn((), device=device, dtype=dtype) +c = torch.randn((), device=device, dtype=dtype) +d = torch.randn((), device=device, dtype=dtype) + +learning_rate = 1e-6 +for t in range(2000): + # Forward pass: compute predicted y + y_pred = a + b * x + c * x ** 2 + d * x ** 3 + + # Compute and print loss + loss = (y_pred - y).pow(2).sum().item() + if t % 100 == 99: + print(t, loss) + + # Backprop to compute gradients of a, b, c, d with respect to loss + grad_y_pred = 2.0 * (y_pred - y) + grad_a = grad_y_pred.sum() + grad_b = (grad_y_pred * x).sum() + grad_c = (grad_y_pred * x ** 2).sum() + grad_d = (grad_y_pred * x ** 3).sum() + + # Update weights using gradient descent + a -= learning_rate * grad_a + b -= learning_rate * grad_b + c -= learning_rate * grad_c + d -= learning_rate * grad_d + + +print(f'Result: y = {a.item()} + {b.item()} x + {c.item()} x^2 + {d.item()} x^3') From 920416d1163e23516b503dcdbeb15b63dd729f7b Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Fri, 29 Aug 2025 14:38:28 -0400 Subject: [PATCH 3/5] Update CHANGELOG.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3b0803..14b4a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Update example Miniforge version to 25.3.1-3 +- Update example Miniforge version to 25.3.1-0 - Update example Python version to 3.13 - Re-enable `basemap` installation by default - This is now possible as `basemap` has been updated to support `numpy` v2 From b7b34f8116fe89bb4dcf91179dc5552d7cda94e8 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 2 Sep 2025 14:32:37 -0400 Subject: [PATCH 4/5] Move rasterio to conda --- CHANGELOG.md | 2 ++ install_miniforge.bash | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14b4a5f..88851cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Rename `always_circular_stereo.py` to `cartopy_example.py` - Enable TensorFlow installation for Python 3.13 - This is now possible as TensorFlow has been updated to support Python 3.13 +- Moved `rasterio` to be a Conda package instead of Pip + - This is because `contextily` (a Conda package) depends on `rasterio` and it is better to have both installed via the same package manager ### Added diff --git a/install_miniforge.bash b/install_miniforge.bash index d115756..85ac8b7 100755 --- a/install_miniforge.bash +++ b/install_miniforge.bash @@ -603,7 +603,7 @@ $PACKAGE_INSTALL earthaccess $PACKAGE_INSTALL uxarray -$PACKAGE_INSTALL contextily +$PACKAGE_INSTALL rasterio contextily # Only install pythran on linux. On mac it brings in an old clang if [[ $MINIFORGE_ARCH == Linux ]] @@ -647,7 +647,7 @@ $PACKAGE_INSTALL -c conda-forge/label/renamed nc_time_axis PIP_INSTALL="$MINIFORGE_ENVDIR/bin/$PYTHON_EXEC -m pip install" PIP_UNINSTALL="$MINIFORGE_ENVDIR/bin/$PYTHON_EXEC -m pip uninstall -y" -$PIP_INSTALL PyRTF3 pipenv pymp-pypi rasterio h5py +$PIP_INSTALL PyRTF3 pipenv pymp-pypi h5py $PIP_INSTALL pycircleci metpy siphon questionary xgrads $PIP_INSTALL ruamel.yaml $PIP_INSTALL xgboost From 723638abd27b4c3070388a751d156a8af375e9cf Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Tue, 30 Sep 2025 11:27:57 -0400 Subject: [PATCH 5/5] Add ecmwf-opendata --- CHANGELOG.md | 1 + install_miniforge.bash | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88851cc..767189a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Explicit Pip Packages - nco - cdo + - ecmwf-opendata - Add new pytorch test ### Removed diff --git a/install_miniforge.bash b/install_miniforge.bash index 85ac8b7..15ae7b9 100755 --- a/install_miniforge.bash +++ b/install_miniforge.bash @@ -664,6 +664,7 @@ $PIP_INSTALL Flask $PIP_INSTALL goes2go $PIP_INSTALL nco $PIP_INSTALL cdo +$PIP_INSTALL ecmwf-opendata # some packages require a Fortran compiler. This sometimes isn't available # on macs (though usually is)