From c9d9484d4fbc894f877a0b4e1aa0d1467f284279 Mon Sep 17 00:00:00 2001 From: Scott McMillan Date: Wed, 26 Mar 2025 15:45:17 -0500 Subject: [PATCH] Bump default Conda version to 25.1.1-2 and add Arm support --- docs/building_blocks.md | 4 ++-- hpccm/building_blocks/conda.py | 12 +++++++----- test/test_conda.py | 36 +++++++++++++++++++++++++++------- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/docs/building_blocks.md b/docs/building_blocks.md index 5ab9f4b0..251a3a7b 100644 --- a/docs/building_blocks.md +++ b/docs/building_blocks.md @@ -598,10 +598,10 @@ Anaconda should be installed. The default is False. - __python_subversion__: The Python version to install. This value is ignored if the Conda version is less than 4.8. The default is -`py310` if using Python 3, and `py27` if using Python 2. +`py312` if using Python 3, and `py27` if using Python 2. - __version__: The version of Anaconda to download. The default value -is `23.1.0-1` if using Python 3, and `4.8.3` if using Python 2. +is `25.1.1-2` if using Python 3, and `4.8.3` if using Python 2. __Examples__ diff --git a/hpccm/building_blocks/conda.py b/hpccm/building_blocks/conda.py index 8fd2a458..01d070e9 100644 --- a/hpccm/building_blocks/conda.py +++ b/hpccm/building_blocks/conda.py @@ -66,10 +66,10 @@ class conda(bb_base, hpccm.templates.rm, hpccm.templates.wget): python_subversion: The Python version to install. This value is ignored if the Conda version is less than 4.8. The default is - `py310` if using Python 3, and `py27` if using Python 2. + `py312` if using Python 3, and `py27` if using Python 2. version: The version of Anaconda to download. The default value - is `23.1.0-1` if using Python 3, and `4.8.3` if using Python 2. + is `25.1.1-2` if using Python 3, and `4.8.3` if using Python 2. # Examples @@ -109,8 +109,8 @@ def __init__(self, **kwargs): self.__python2 = kwargs.get('python2', False) self.__python_version = '2' if self.__python2 else '3' self.__python_subversion = kwargs.get( - 'python_subversion', 'py27' if self.__python2 else 'py310') - self.__version = kwargs.get('version', '4.8.3' if self.__python2 else '23.1.0-1') + 'python_subversion', 'py27' if self.__python2 else 'py312') + self.__version = kwargs.get('version', '4.8.3' if self.__python2 else '25.1.1-2') self.__commands = [] # Filled in by __setup() self.__wd = kwargs.get('wd', hpccm.config.g_wd) # working directory @@ -141,7 +141,9 @@ def __cpu_arch(self): """Based on the CPU architecture, set values accordingly. A user specified value overrides any defaults.""" - if hpccm.config.g_cpu_arch == cpu_arch.PPC64LE: + if hpccm.config.g_cpu_arch == cpu_arch.AARCH64: + self.__arch_pkg = 'aarch64' + elif hpccm.config.g_cpu_arch == cpu_arch.PPC64LE: self.__arch_pkg = 'ppc64le' elif hpccm.config.g_cpu_arch == cpu_arch.X86_64: self.__arch_pkg = 'x86_64' diff --git a/test/test_conda.py b/test/test_conda.py index f7875090..7eb8a2a0 100644 --- a/test/test_conda.py +++ b/test/test_conda.py @@ -22,7 +22,7 @@ import logging # pylint: disable=unused-import import unittest -from helpers import centos, docker, ppc64le, ubuntu, x86_64 +from helpers import aarch64, centos, docker, ppc64le, ubuntu, x86_64 from hpccm.building_blocks.conda import conda @@ -44,15 +44,15 @@ def test_defaults_ubuntu(self): ca-certificates \ wget && \ rm -rf /var/lib/apt/lists/* -RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp http://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh && \ - bash /var/tmp/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh -b -p /usr/local/anaconda && \ +RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp http://repo.anaconda.com/miniconda/Miniconda3-py312_25.1.1-2-Linux-x86_64.sh && \ + bash /var/tmp/Miniconda3-py312_25.1.1-2-Linux-x86_64.sh -b -p /usr/local/anaconda && \ /usr/local/anaconda/bin/conda init && \ ln -s /usr/local/anaconda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \ . /usr/local/anaconda/etc/profile.d/conda.sh && \ conda activate base && \ conda install -y numpy && \ /usr/local/anaconda/bin/conda clean -afy && \ - rm -rf /var/tmp/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh''') + rm -rf /var/tmp/Miniconda3-py312_25.1.1-2-Linux-x86_64.sh''') @x86_64 @centos @@ -66,15 +66,37 @@ def test_defaults_centos(self): ca-certificates \ wget && \ rm -rf /var/cache/yum/* -RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp http://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh && \ - bash /var/tmp/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh -b -p /usr/local/anaconda && \ +RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp http://repo.anaconda.com/miniconda/Miniconda3-py312_25.1.1-2-Linux-x86_64.sh && \ + bash /var/tmp/Miniconda3-py312_25.1.1-2-Linux-x86_64.sh -b -p /usr/local/anaconda && \ /usr/local/anaconda/bin/conda init && \ ln -s /usr/local/anaconda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \ . /usr/local/anaconda/etc/profile.d/conda.sh && \ conda activate base && \ conda install -y numpy && \ /usr/local/anaconda/bin/conda clean -afy && \ - rm -rf /var/tmp/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh''') + rm -rf /var/tmp/Miniconda3-py312_25.1.1-2-Linux-x86_64.sh''') + + @aarch64 + @centos + @docker + def test_aarch64(self): + """Default conda building block""" + c = conda(eula=True, packages=['numpy'], version='25.1.1-2') + self.assertEqual(str(c), +r'''# Anaconda +RUN yum install -y \ + ca-certificates \ + wget && \ + rm -rf /var/cache/yum/* +RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp http://repo.anaconda.com/miniconda/Miniconda3-py312_25.1.1-2-Linux-aarch64.sh && \ + bash /var/tmp/Miniconda3-py312_25.1.1-2-Linux-aarch64.sh -b -p /usr/local/anaconda && \ + /usr/local/anaconda/bin/conda init && \ + ln -s /usr/local/anaconda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \ + . /usr/local/anaconda/etc/profile.d/conda.sh && \ + conda activate base && \ + conda install -y numpy && \ + /usr/local/anaconda/bin/conda clean -afy && \ + rm -rf /var/tmp/Miniconda3-py312_25.1.1-2-Linux-aarch64.sh''') @ppc64le @ubuntu