From bdb3c243c90109db65f5d1e301a2fa7d604463b8 Mon Sep 17 00:00:00 2001 From: Espen Hagen <2492641+espenhgn@users.noreply.github.com> Date: Wed, 3 Dec 2025 15:08:26 +0100 Subject: [PATCH 1/2] `Python3.sif`: broken ipython magic Fixes #320 --- tests/test_python3.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_python3.py b/tests/test_python3.py index 6b548ef3..bc63b342 100644 --- a/tests/test_python3.py +++ b/tests/test_python3.py @@ -21,6 +21,7 @@ subprocess.run('apptainer', check=False) PREFIX = f'apptainer run {pth}' PREFIX_MOUNT = f'apptainer run --home={cwd}:/home/ {pth}' + IPYTHON = f'{PREFIX} ipython' PYTHON = f'{PREFIX} python' PYTHON_MOUNT = f'{PREFIX_MOUNT} python' PLINK = f'{PREFIX} plink' @@ -37,6 +38,7 @@ f'--mount type=bind,source={cwd},target={cwd} ' + '--platform linux/amd64 ' + 'ghcr.io/comorment/python3') + IPYTHON = f'{PREFIX} ipython' PYTHON = f'{PREFIX} python' PYTHON_MOUNT = f'{PREFIX_MOUNT} python' PLINK = f'{PREFIX} plink' @@ -46,6 +48,7 @@ except FileNotFoundError: # neither apptainer nor docker found, fall back to plain python # presumably because we are running on the client + IPYTHON = 'ipython' PYTHON = 'python' PYTHON_MOUNT = 'python' PLINK = 'plink' @@ -151,3 +154,8 @@ def test_python3_import_pandas_scipy_stats(): call = f'{PYTHON_MOUNT} -c "import pandas as pd; from scipy import *"' out = subprocess.run(call, shell=True, check=False) assert out.returncode == 0 + +def test_python3_ipython_magic(): + call = f'{IPYTHON} -c "get_ipython().run_line_magic(\'matplotlib\', \'inline\')"' + out = subprocess.run(call, shell=True, check=False) + assert out.returncode == 0 \ No newline at end of file From 7fb9d956d5be94720ee30fae5d3ceb4b4dfb7838 Mon Sep 17 00:00:00 2001 From: Espen Hagen <2492641+espenhgn@users.noreply.github.com> Date: Fri, 5 Dec 2025 19:10:25 +0100 Subject: [PATCH 2/2] `Python3.sif`: broken ipython magic, updated Python env to 3.12 Fixes #320 --- CHANGELOG.md | 11 +++ docker/dockerfiles/python3/Dockerfile | 99 ++++++++++--------- ...all_mambaforge.sh => install_miniforge.sh} | 10 +- tests/test_python3.py | 3 +- version/version.py | 4 +- 5 files changed, 72 insertions(+), 55 deletions(-) rename docker/scripts/{install_mambaforge.sh => install_miniforge.sh} (57%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 083c10ed..3ab5b672 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,17 @@ Removed features goes here Miscellaneous goes here +## 1.14.0 - 2025-12-05 + +### Updated + +* Using Miniforge3 installer (was Mambaforge) +* Updated Python (3.10.6 -> 3.12.12) and installed packages in `python3.sif` container. + +### Fixed + +* Fixed issue with %matplotlib inline magic with IPython/Jupyter in `python3.sif` container. + ## 1.13.1 - 2025-11-27 ### diff --git a/docker/dockerfiles/python3/Dockerfile b/docker/dockerfiles/python3/Dockerfile index ed23eadb..c9564a17 100644 --- a/docker/dockerfiles/python3/Dockerfile +++ b/docker/dockerfiles/python3/Dockerfile @@ -11,63 +11,68 @@ RUN bash apt_get_essential.sh && \ rm apt_get_essential.sh WORKDIR /tmp -COPY /scripts/install_mambaforge.sh . -RUN bash install_mambaforge.sh && \ - rm install_mambaforge.sh +COPY /scripts/install_miniforge.sh . +RUN bash install_miniforge.sh && \ + rm install_miniforge.sh + +RUN conda install mamba -n base -c conda-forge && \ + conda clean -a -y # set up python env. # keep the list of packages sorted alphabetically # https://www.online-utility.org/text/sort.jsp -RUN mamba install python=3.10.6 \ - configparser=7.0.0 \ - dask=2023.3.0 \ +RUN mamba install python=3.12.12 \ + configparser=7.2.0 \ + dask=2025.11.0 \ fastparquet=2024.11.0 \ - graphviz=12.2.1 \ - "h5py=3.7.0=nompi*" \ - jupyterlab=3.4.8 \ - lightgbm=4.5.0 \ - lifelines=0.27.0 \ - imbalanced-learn=0.12.3 \ + graphviz=14.0.5 \ + "h5py=3.15.1=nompi*" \ + jupyterlab=4.5.0 \ + lightgbm=4.6.0 \ + lifelines=0.30.0 \ + imbalanced-learn=0.14.0 \ intervaltree=3.1.0 \ - matplotlib-venn=0.11.5 \ - matplotlib=3.6.0 \ - miniwdl=1.12.1 \ - miniwdl-slurm=0.2.0 \ - more-itertools=9.0.0 \ - networkx=3.4 \ - numdifftools=0.9.39 \ - numba=0.60.0 \ - numpy=1.23.3 \ + matplotlib-venn=1.1.2 \ + matplotlib=3.10.8 \ + miniwdl=1.13.1 \ + miniwdl-slurm=0.4.0 \ + more-itertools=10.8.0 \ + networkx=3.6 \ + numdifftools=0.9.41 \ + numba=0.62.1 \ + numpy=2.3.5 \ openpyxl=3.1.5 \ - pandas=2.2.3 \ - pandas-plink=2.2.9 \ + pandas=2.3.3 \ + pandas-plink=2.3.2 \ paramiko=4.0.0 \ - psutil=5.9.3 \ - pyarrow=19.0.1 \ - pydot=3.0.4 \ - pyreadstat=1.2.7 \ - pytables=3.7.0 \ - python-graphviz=0.20.3 \ - pyyaml=6.0 \ - scikit-learn=1.5.2 \ - scikit-survival=0.23.0 \ - scipy=1.9.1 \ + psutil=7.1.3 \ + pyarrow=22.0.0 \ + pydot=4.0.1 \ + pyreadstat=1.3.2 \ + pytables=3.10.2 \ + python-graphviz=0.21 \ + pyyaml=6.0.3 \ + scikit-learn=1.7.2 \ + scikit-survival=0.25.0 \ + scipy=1.16.3 \ seaborn=0.13.2 \ semantic_version=2.10.0 \ - shap=0.46.0 \ - statsmodels=0.13.2 \ - xgboost=2.1.4 \ - xlrd=2.0.1 \ - xmltodict=0.13.0 \ + shap=0.48.0 \ + statsmodels=0.14.5 \ + xgboost=3.1.2 \ + xlrd=2.0.2 \ + xmltodict=1.0.2 \ --yes && \ mamba clean -a -y # pip install stuff in env. -RUN pip install --no-cache-dir --no-deps cbgen==1.0.2 \ - bgen-reader==4.0.8 \ - bed-reader==0.2.24 \ - dxpy==0.383.1 \ - fastlmm==0.6.3 \ +RUN pip install --no-cache-dir --no-deps \ + bed-reader==1.0.6 \ + bgen-reader==4.0.9 \ + cbgen==1.0.6 \ + crc32c==2.8 \ + dxpy==0.400.1 \ + fastlmm==0.6.12 \ hdf5storage==0.2.2 \ LDpred==1.0.11 \ Pgenlib==0.93.0 \ @@ -75,10 +80,10 @@ RUN pip install --no-cache-dir --no-deps cbgen==1.0.2 \ plinkliftover==0.5.2 \ poetry==2.2.1 \ pooch==1.8.2 \ - pycap==2.1.0 \ + pycap==2.7.0 \ pyliftover==0.4.1 \ - pysnptools==0.5.7 && \ - pip cache purge + pysnptools==0.5.14 && \ + pip cache purge # Plink (as python_convert depends on plink) WORKDIR /tmp/plink @@ -112,4 +117,4 @@ WORKDIR /tools # https://github.com/comorment/containers/issues/267: ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH - + diff --git a/docker/scripts/install_mambaforge.sh b/docker/scripts/install_miniforge.sh similarity index 57% rename from docker/scripts/install_mambaforge.sh rename to docker/scripts/install_miniforge.sh index b9991a39..1104eb82 100644 --- a/docker/scripts/install_mambaforge.sh +++ b/docker/scripts/install_miniforge.sh @@ -1,10 +1,10 @@ #!/bin/sh set -euo pipefail -version=25.3.1-0 -curl -sSL https://github.com/conda-forge/miniforge/releases/download/$version/Miniforge3-$version-$(uname)-$(uname -m).sh -o /tmp/mambaforge.sh \ - && mkdir /root/.conda \ - && bash /tmp/mambaforge.sh -bfp /usr/local \ - && rm -rf /tmp/mambaforge.sh +version=25.11.0-1 +curl -sSL https://github.com/conda-forge/miniforge/releases/download/$version/Miniforge3-$version-$(uname)-$(uname -m).sh -o /tmp/miniforge.sh +mkdir /root/.conda +bash /tmp/miniforge.sh -bfp /usr/local +rm -rf /tmp/miniforge.sh export PATH=$PATH:/opt/conda/bin diff --git a/tests/test_python3.py b/tests/test_python3.py index bc63b342..399089b2 100644 --- a/tests/test_python3.py +++ b/tests/test_python3.py @@ -107,6 +107,7 @@ def test_python3_miniwdl(): def test_python3_packages(): packages = [ 'configparser', + 'crc32c', 'dask', 'fastparquet', 'dxpy', @@ -158,4 +159,4 @@ def test_python3_import_pandas_scipy_stats(): def test_python3_ipython_magic(): call = f'{IPYTHON} -c "get_ipython().run_line_magic(\'matplotlib\', \'inline\')"' out = subprocess.run(call, shell=True, check=False) - assert out.returncode == 0 \ No newline at end of file + assert out.returncode == 0 diff --git a/version/version.py b/version/version.py index be6b93fa..2ca129dd 100644 --- a/version/version.py +++ b/version/version.py @@ -1,8 +1,8 @@ _MAJOR = "1" -_MINOR = "13" +_MINOR = "14" # On main and in a nightly release the patch should be one ahead of the last # released build. -_PATCH = "1" +_PATCH = "0" # This is mainly for nightly builds which have the suffix ".dev$DATE". See # https://semver.org/#is-v123-a-semantic-version for the semantics. _SUFFIX = ""