Image size: 2.8 GB

For more on pulling from the registry, see the ilifu documentation.

First, once: add the registry and make it your default

singularity remote add --no-login idia-registry https://sregistry.idia.ac.za
singularity remote use idia-registry

If you added it before, as the ilifu docs describe, remote add says it already exists: just run remote use.

Log in, for a private collection

singularity remote login idia-registry

Paste a token from your token page when asked. Public collections need no login.

Pull the container

singularity pull library://casa/casa:v6.4.3

Shell into the container

singularity shell library://casa/casa:v6.4.3

Run the container

singularity run library://casa/casa:v6.4.3

First, once: add the registry and make it your default

apptainer remote add --no-login idia-registry https://sregistry.idia.ac.za
apptainer remote use idia-registry

If you added it before, as the ilifu docs describe, remote add says it already exists: just run remote use.

Log in, for a private collection

apptainer remote login idia-registry

Paste a token from your token page when asked. Public collections need no login.

Pull the container

apptainer pull library://casa/casa:v6.4.3

Shell into the container

apptainer shell library://casa/casa:v6.4.3

Run the container

apptainer run library://casa/casa:v6.4.3
# Bootstrap: debootstrap
# MirrorURL: http://archive.ubuntu.com/ubuntu/
# OSVersion: bionic
# Include: software-properties-common

BootStrap: docker
From: ubuntu:20.04

%labels
        APPLICATION_NAME Ubuntu LTS + CASA 6
        OS_VERSION 20.04
        APPLICATION_URL https://casa.nrao.edu/casadocs/latest/usingcasa/obtaining-and-installing

        SYSTEM_NAME iLifu
        SYSTEM_SINGULARITY_VERSION 3.5.2
        SYSTEM_URL http://www.ilifu.ac.za

        AUTHOR_NAME IDIA
        AUTHOR_EMAIL support@ilifu.ac.za

%environment

        # export PATH=/anaconda3/bin:${PATH}
        export PYTHONPATH=$PYTHONPATH:/opt/casaaddons
	export XDG_RUNTIME_DIR=$HOME

%post
        # apt-get install -y python-is-python3
        # Create Installation Directories and export paths. This is needed as part of post.
        # %environment scriptlet does not define these paths during %post, only after.
        mkdir -p /opt
        export DEBIAN_FRONTEND=noninteractive

        # Installation of initial packages
        apt-get update -y
        apt-get install -y software-properties-common
        apt-get install -y wget vim apt-utils git build-essential bzip2 libpng-dev gfortran gfortran xvfb ghostscript curl pkg-config libxi-dev libfuse-dev python-is-python3
        add-apt-repository universe
        add-apt-repository multiverse
        add-apt-repository restricted
        add-apt-repository -s ppa:kernsuite/kern-7
        apt-get install -y casacore-dev casacore-data
        # Install OpenMPI
	#cd /opt
	#wget -O -  https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.0.tar.gz | tar xz
        #cd openmpi-4.1.0
        #./configure
        #make all install
        #ldconfig

	# Install Anaconda for python package management
        # cd /opt
        # wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh
        # bash Anaconda3-5.2.0-Linux-x86_64.sh -b -p /anaconda3
        # rm Anaconda3-5.2.0-Linux-x86_64.sh
        # export PATH="/anaconda3/bin:$PATH"

        # # Update python to 3.6.8 for compatibility with PyBDSF
        # conda install -y python==3.6.8	

        # #remove distutil install conflict
        # rm -r /anaconda3/lib/python3.6/site-packages/llvmlite*
        # Update pip and install python packages
        apt-get install -y python3-pip
        pip install --upgrade cloudpickle holoviews datashader bokeh pandas dask-ms[xarray] scipy
        pip install --no-binary :all: python-casacore
        # conda install --channel defaults conda python=3.6.8 --yes
        # conda update --channel defaults --all --yes
        # conda install -y -c conda-forge phantomjs        

        # Install Jupyter for IPykernel
        pip install jupyter ipykernel

        # Install PyBDSF
        apt-get install -y libboost-python-dev libboost-numpy-dev python-setuptools
        pip install --upgrade numpy scikit-image
        # pip install --use-deprecated=legacy-resolver astropy==4.1 bdsf matplotlib katdal astroquery
        pip install astropy==4.1 bdsf matplotlib katdal astroquery
        apt-get install -y pybdsf
        # apt-get install libgeos-3.6.2 libgeos-c1v5 libgeos-dev

        # Install CASA 6
        apt-get install -y libopenmpi-dev
        pip install --index-url https://casa-pip.nrao.edu/repository/pypi-casa-release/simple casatools
        pip install --index-url https://casa-pip.nrao.edu/repository/pypi-casa-release/simple casatasks
        pip install --index-url https://casa-pip.nrao.edu/repository/pypi-casa-release/simple casampi
        pip install --index-url=https://go.nrao.edu/pypi casadata

        # wget https://github.com/protocolbuffers/protobuf/releases/download/v3.12.4/protobuf-all-3.12.4.tar.gz
        # tar -xzf protobuf-all-3.12.4.tar.gz
        # cd protobuf-3.12.4/ && ./configure && make && make install
        pip install protobuf
        # Install unvalidated packages
        pip install --index-url https://casa-pip.nrao.edu/repository/pypi-casa-release/simple casaviewer
        pip install --index-url https://casa-pip.nrao.edu/repository/pypi-casa-release/simple casaplotms
	pip install --index-url https://casa-pip.nrao.edu/repository/pypi-casa-release/simple casashell

        cd /opt
        git clone https://open-bitbucket.nrao.edu/scm/casa/casaaddons.git

        # Fix command prompt in Singularity 3.5.2
        printf 'export PS1="\u@$SINGULARITY_NAME:\w$ "' > /.singularity.d/env/999-psvars.sh

        # Cleanup the container
        apt-get clean
        apt-get autoclean

%runscript

	python "$@"
Download casa-casa_v6.4.3.def