Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions docs/building_blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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__

Expand Down
12 changes: 7 additions & 5 deletions hpccm/building_blocks/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down
36 changes: 29 additions & 7 deletions test/test_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down
Loading