casa/casa-modular:v6.7.3-py3.12-2026-04-01
Version sha256.7e43a0c5929d6be262e4ac8b24d079ebe4cf36e753705e2fa573a94e0d25d0d5
Image size: 4.7 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-modular:v6.7.3-py3.12-2026-04-01
Shell into the container
singularity shell library://casa/casa-modular:v6.7.3-py3.12-2026-04-01
Run the container
singularity run library://casa/casa-modular:v6.7.3-py3.12-2026-04-01
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-modular:v6.7.3-py3.12-2026-04-01
Shell into the container
apptainer shell library://casa/casa-modular:v6.7.3-py3.12-2026-04-01
Run the container
apptainer run library://casa/casa-modular:v6.7.3-py3.12-2026-04-01
Bootstrap: debootstrap
MirrorURL: http://archive.ubuntu.com/ubuntu/
OSVersion: noble
%labels
APPLICATION_NAME Ubuntu LTS + CASA 6 (Modular)
OS_VERSION 24.01
APPLICATION_URL https://casadocs.readthedocs.io/en/stable/notebooks/introduction.html#Modular-Packages
SYSTEM_NAME iLifu
SYSTEM_SINGULARITY_VERSION 4.1.3
SYSTEM_URL http://www.ilifu.ac.za
AUTHOR_NAME IDIA
AUTHOR_EMAIL support@ilifu.ac.za
%environment
export VIRTUAL_ENV=/opt/casa-venv
export PATH="/opt/casa-venv/bin:$PATH"
export PYTHONPATH="/opt/casa-venv/lib/python3.12/site-packages:$PYTHONPATH"
export PYTHONPATH=$PYTHONPATH:/opt/casaaddons
export XDG_RUNTIME_DIR=$HOME
# the matching Qt5 libraries shipped with the AppImage.
export LD_LIBRARY_PATH=/opt/casaplotms/usr/lib:/opt/casaviewer/usr/lib:/opt/casatablebrowser/usr/lib:/opt/casalogger/usr/lib:/opt/casafeather/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export PATH=$PATH:/opt/casaplotms/usr/bin
export PATH=$PATH:/opt/casaviewer/usr/bin
export PATH=$PATH:/opt/casatablebrowser/usr/bin
export PATH=$PATH:/opt/casalogger/usr/bin
export PATH=$PATH:/opt/casafeather/usr/bin
export PATH=$PATH:~/.local/bin
export CASARCFILES=/opt/.casarc
# Set Qt platform plugin path to use AppImage-extracted plugins
export QT_QPA_PLATFORM_PLUGIN_PATH=/opt/casaplotms/usr/plugins/platforms/
# Set display for X11 - will be overridden by host DISPLAY
#export DISPLAY=$DISPLAY
# Force Qt to use xcb platform
export QT_QPA_PLATFORM=xcb
# Add XDG runtime directory for Qt
export XDG_RUNTIME_DIR=/tmp/runtime-$USER
# Set Qt to not use MIT-SHM extension (can cause issues in containers)
export QT_X11_NO_MITSHM=1
# CRITICAL: Unset host LD_LIBRARY_PATH to prevent library conflicts
unset LD_LIBRARY_PATH
# Set container-specific LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu
%post
# 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
# CRITICAL: Set LD_LIBRARY_PATH inside container during build
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu
# Installation of initial packages
apt-get update -y
apt-get install -y software-properties-common
add-apt-repository universe
add-apt-repository -y multiverse
add-apt-repository -y restricted
apt-get update -y
apt-get install -y wget vim apt-utils git build-essential bzip2 libpng-dev gfortran xvfb ghostscript curl pkg-config libxi-dev libfuse-dev python-is-python3
apt-get install -y fuse
apt-get install -y perl
# FIX: Install SQLite inside container FIRST
apt-get install -y libsqlite3-dev sqlite3 libsqlite3-0
# Download and compile latest SQLite INSIDE container
cd /tmp
wget https://www.sqlite.org/2024/sqlite-autoconf-3450100.tar.gz
tar xzf sqlite-autoconf-3450100.tar.gz
cd sqlite-autoconf-3450100
./configure --prefix=/usr/local
make -j$(nproc)
make install
# Update ldconfig inside container
ldconfig
# Installing plotms dependencies
apt-get install -y libc-ares-dev libgoogle-perftools-dev libgrpc-dev
apt-get install -y casacore-dev casacore-data
# Update pip and install python packages
apt-get install -y python3-pip
# Install Python 3.12 with venv support
apt-get install -y python3.12 python3.12-dev python3.12-venv
# Create virtual environment
cd /opt
python3.12 -m venv casa-venv
. /opt/casa-venv/bin/activate
pip3.12 install --upgrade pip wheel
# FIX: Install pysqlite3 from source, linking against container's SQLite
pip3.12 install --upgrade --force-reinstall --no-binary pysqlite3 pysqlite3
# Continue with package installation
pip3.12 install --upgrade cloudpickle holoviews datashader bokeh pandas "dask-ms[xarray]" scipy==1.13.0 protobuf==3.20 scikit-image katdal astroquery DateTime
pip3.12 install --no-binary :all: python-casacore
pip3.12 install pyvirtualdisplay
# Install Jupyter for IPykernel
pip3.12 install jupyter ipykernel
pip3.12 install numpy==1.26.4
#MATPLOTLIB FIX FOR PYTHON 3.12 + CASA
# 1. Ensure the venv is isolated from system packages
# This prevents the venv from "seeing" the system's broken mpl_toolkits
sed -i 's/include-system-site-packages = true/include-system-site-packages = false/g' /opt/casa-venv/pyvenv.cfg
# 2. Update Matplotlib to a 3.12-compatible version
# CASA tasks generally work fine with newer Matplotlib; 3.5.3 is the source of the crash.
. /opt/casa-venv/bin/activate
pip3.12 install --upgrade pip
pip3.12 uninstall -y matplotlib mpl_toolkits
# Install 3.8.0 or higher for full Python 3.12 compatibility
pip3.12 install "matplotlib>=3.8.0"
#fix libraries: libgrpc.so.7: cannot open shared object file
ln -sf /usr/lib/x86_64-linux-gnu/libgrpc.so.10 /usr/lib/x86_64-linux-gnu/libgrpc.so.7
ln -sf /usr/lib/x86_64-linux-gnu/libgpr.so.10 /usr/lib/x86_64-linux-gnu/libgpr.so.7 || true
ldconfig
# Fix missing ICU SONAMEs: some AppImage-extracted binaries expect
# libicui18n.so.60 / libicuuc.so.60 / libicudata.so.60 (from older
# Ubuntu). Jammy provides newer libicu (e.g. .so.70); provide
# compatibility symlinks so the loader can find them.
ln -sf /usr/lib/x86_64-linux-gnu/libicui18n.so.70 /usr/lib/x86_64-linux-gnu/libicui18n.so.60 || true
ln -sf /usr/lib/x86_64-linux-gnu/libicuuc.so.70 /usr/lib/x86_64-linux-gnu/libicuuc.so.60 || true
ln -sf /usr/lib/x86_64-linux-gnu/libicudata.so.70 /usr/lib/x86_64-linux-gnu/libicudata.so.60 || true
ldconfig || true
# Install Qt dependencies - DO NOT install Qt6 system packages (conflict with AppImage's Qt6.6)
apt-get install -y \
libxcb-xinerama0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-shape0 \
libxcb-sync1 \
libxcb-xfixes0 \
libxcb-xkb1 \
libxkbcommon-x11-0 \
libxkbcommon0 \
x11-utils \
libglx-mesa0 \
mesa-vulkan-drivers \
libgl1 \
xauth \
dbus-x11 \
qtbase5-dev \
qtchooser \
qt5-qmake \
qtbase5-dev-tools
# Install PyBDSF
apt-get install -y libboost-python-dev
pip3.12 install --upgrade PyQt5==5.15.7
pip3.12 install --upgrade astropy
pip3.12 install bdsf[ishell]
# Install Healpy
apt-get install -y python3-healpy
# Install PYGDSM
pip3.12 install h5py
pip3.12 install git+https://github.com/telegraphic/pygdsm
# Install CASA 6
apt-get install -y libopenmpi-dev
pip3.12 install casaconfig==1.4.0
pip3.12 install casatools==6.7.3.21
pip3.12 install casatasks==6.7.3.21
pip3.12 install casaplotms==2.8.2
pip3.12 install casaviewer==2.4.4
pip3.12 install casashell==6.7.3.21
pip3.12 install casaplotserver==2.0.3
pip3.12 install casatestutils==6.7.3.21
pip3.12 install casatablebrowser==0.0.40
pip3.12 install casalogger==1.0.23
pip3.12 install casafeather==0.0.27
pip3.12 install casampi==0.5.9
cd /opt
git clone https://open-bitbucket.nrao.edu/scm/casa/casaaddons.git
# Install katbeam
pip3.12 install git+https://github.com/ska-sa/katbeam
# Extract and fix AppImage applications due to FUSE issues
# CASAplotMS - Use the Python 3.12 path
cd /opt
echo "Looking for AppImage in Python 3.12 site-packages..."
find /opt/casa-venv/lib/python3.12/site-packages -name "casaplotms-x86_64.AppImage" -type f
# Extract casaplotms AppImage
/opt/casa-venv/lib/python3.12/site-packages/casaplotms/__bin__/casaplotms-x86_64.AppImage --appimage-extract
mv squashfs-root casaplotms
chmod -R go+rx /opt/casaplotms
# FIX: Force casaplotms to use its bundled Qt libraries instead of system ones
# Create wrapper script that sets LD_LIBRARY_PATH to AppImage's bundled libs first
cat > /opt/casaplotms/usr/bin/casaplotms-wrapper << 'EOF'
#!/bin/bash
# Set library path to use AppImage's bundled libraries first
export LD_LIBRARY_PATH="/opt/casaplotms/usr/lib:/opt/casaplotms/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH"
# Execute the real binary
exec /opt/casaplotms/usr/bin/casaplotms "$@"
EOF
chmod +x /opt/casaplotms/usr/bin/casaplotms-wrapper
# Create symlinks for Qt plugins in AppImage directory
mkdir -p /opt/casaplotms/usr/plugins/platforms/
# Find and copy the xcb plugin from AppImage
find /opt/casaplotms -name "libqxcb.so" -exec cp {} /opt/casaplotms/usr/plugins/platforms/ \; 2>/dev/null || true
# If not found in AppImage, create a symlink to system
if [ ! -f /opt/casaplotms/usr/plugins/platforms/libqxcb.so ]; then
mkdir -p /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/
ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so /opt/casaplotms/usr/plugins/platforms/ 2>/dev/null || true
fi
# Fix the plotmstool.py path - use wrapper instead of direct binary
sed -i -e "s|app_path = __os.path.join( __os.path.abspath( __os.path.join(__os.path.dirname(__file__),\"..\") ), '__bin__/casaplotms-x86_64.AppImage')|app_path = '/opt/casaplotms/usr/bin/casaplotms-wrapper'|g" /opt/casa-venv/lib/python3.12/site-packages/casaplotms/private/plotmstool.py
# CASAviewer - use Python 3.12 path
/opt/casa-venv/lib/python3.12/site-packages/casaviewer/__bin__/casaviewer-x86_64.AppImage --appimage-extract
mv squashfs-root casaviewer
chmod -R go+rx /opt/casaviewer
sed -i -e "s|app_path = __os.path.join( __os.path.abspath(__os.path.join(__os.path.dirname(__file__),'..')), '__bin__/casaviewer-x86_64.AppImage' )|app_path = '/opt/casaviewer/usr/bin/casaviewer'|g" /opt/casa-venv/lib/python3.12/site-packages/casaviewer/private/config.py
# CASAtablebrowser - use Python 3.12 path
/opt/casa-venv/lib/python3.12/site-packages/casatablebrowser/__bin__/casatablebrowser-x86_64.AppImage --appimage-extract
mv squashfs-root casatablebrowser
chmod -R go+rx /opt/casatablebrowser
sed -i -e "s|app_path = __os.path.abspath(__os.path.dirname(__file__))|app_path = '/opt/casatablebrowser/usr/bin'|g" /opt/casa-venv/lib/python3.12/site-packages/casatablebrowser/__casatablebrowser.py
sed -i -e 's|app_path = __os.path.join( app_path, "__bin__","casatablebrowser-x86_64.AppImage" )|app_path = __os.path.join( app_path, "casatablebrowser" )|g' /opt/casa-venv/lib/python3.12/site-packages/casatablebrowser/__casatablebrowser.py
# CASAlogger - use Python 3.12 path
/opt/casa-venv/lib/python3.12/site-packages/casalogger/__bin__/casalogger-x86_64.AppImage --appimage-extract
mv squashfs-root casalogger
chmod -R go+rx /opt/casalogger
sed -i -e "s|app_path = os.path.join(|app_path = '/opt/casalogger/usr/bin/casalogger'|g" /opt/casa-venv/lib/python3.12/site-packages/casalogger/casalogger.py
sed -i '31,33d' /opt/casa-venv/lib/python3.12/site-packages/casalogger/casalogger.py
# CASAfeather - use Python 3.12 path
/opt/casa-venv/lib/python3.12/site-packages/casafeather/__bin__/casafeather-x86_64.AppImage --appimage-extract
mv squashfs-root casafeather
chmod -R go+rx /opt/casafeather
sed -i -e "s|app_path = __os.path.join(|app_path = '/opt/casafeather/usr/bin/casafeather'|g" /opt/casa-venv/lib/python3.12/site-packages/casafeather/casafeather.py
sed -i '52,54d' /opt/casa-venv/lib/python3.12/site-packages/casafeather/casafeather.py
deactivate
# Fix path to casacore data (https://github.com/casacore/python-casacore/issues/181)
echo 'measures.directory: /usr/share/casacore/data' > /opt/.casarc
# 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
# Use the container's Python from virtual environment
exec /opt/casa-venv/bin/python "$@"
Download casa-casa-modular_v6.7.3-py3.12-2026-04-01.def
#!/bin/sh
# Use the container's Python from virtual environment
exec /opt/casa-venv/bin/python "$@"
# /.singularity.d/env/90-environment.sh
#!/bin/sh
# Custom environment shell code should follow
export VIRTUAL_ENV=/opt/casa-venv
export PATH="/opt/casa-venv/bin:$PATH"
export PYTHONPATH="/opt/casa-venv/lib/python3.12/site-packages:$PYTHONPATH"
export PYTHONPATH=$PYTHONPATH:/opt/casaaddons
export XDG_RUNTIME_DIR=$HOME
# the matching Qt5 libraries shipped with the AppImage.
export LD_LIBRARY_PATH=/opt/casaplotms/usr/lib:/opt/casaviewer/usr/lib:/opt/casatablebrowser/usr/lib:/opt/casalogger/usr/lib:/opt/casafeather/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export PATH=$PATH:/opt/casaplotms/usr/bin
export PATH=$PATH:/opt/casaviewer/usr/bin
export PATH=$PATH:/opt/casatablebrowser/usr/bin
export PATH=$PATH:/opt/casalogger/usr/bin
export PATH=$PATH:/opt/casafeather/usr/bin
export PATH=$PATH:~/.local/bin
export CASARCFILES=/opt/.casarc
# Set Qt platform plugin path to use AppImage-extracted plugins
export QT_QPA_PLATFORM_PLUGIN_PATH=/opt/casaplotms/usr/plugins/platforms/
# Set display for X11 - will be overridden by host DISPLAY
#export DISPLAY=$DISPLAY
# Force Qt to use xcb platform
export QT_QPA_PLATFORM=xcb
# Add XDG runtime directory for Qt
export XDG_RUNTIME_DIR=/tmp/runtime-$USER
# Set Qt to not use MIT-SHM extension (can cause issues in containers)
export QT_X11_NO_MITSHM=1
# CRITICAL: Unset host LD_LIBRARY_PATH to prevent library conflicts
unset LD_LIBRARY_PATH
# Set container-specific LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu