Jupyter Notebook is an open source web application environment used to create and share documents containing code, equations, visualizations and narrative text. Use cases include data visualization, statistical modeling and machine learning.
Singularity provides a basis for repeatability with a container runtime that does not require root owned daemon or allow escalation of user privilege when ran. With it’s single file image format (SIF) Singularity is ideal for BYOE science (bring your own environment) and for the mobility of compute with deep learning applications.
We’ll use the following Singularity definition file when building Jupyter:
Bootstrap: library From: debian:9 %help Container with Anaconda (Conda 4.5.11) and Jupyter Notebook 5.6.0 for Debian 9.x (Stretch). This installation is based on Python 2.7.15 %setup #Create the .condarc file where the environments/channels from conda are specified, #these are pulled with preference to root cd / touch .condarc %post #Installing all dependencies apt-get update && apt-get -y upgrade apt-get -y install \ build-essential \ wget \ bzip2 \ ca-certificates \ libglib2.0-0 \ libxext6 \ libsm6 \ libxrender1 \ git rm -rf /var/lib/apt/lists/* apt-get clean #Installing Anaconda 2 and Conda 4.5.11 wget -c https://repo.continuum.io/archive/Anaconda2-5.3.0-Linux-x86_64.sh /bin/bash Anaconda2-5.3.0-Linux-x86_64.sh -bfp /usr/local #Conda configuration of channels from .condarc file conda config --file /.condarc --add channels defaults conda config --file /.condarc --add channels conda-forge conda update conda #List installed environments conda list %runscript jupyter notebook --allow-root "$@"
To build the image run the following command:
$ sudo singularity build jupyter.sif jupyter.def
The definition file above has a %post section in which all the dependencies are installed at build time. After that, you can start the container and, it will listen on localhost:8888 by default.
$ singularity run jupyter.sif
If you would like to run it on another port (e.g. 9000) instead you can do so by:
$ singularity run jupyter.sif --port=9000
This will run Jupyter Notebook on localhost:9000.
And if you would like to set another hostname use ––ip when running the image:
$ singularity run jupyter.sif --ip=22.214.171.124 --port=9000
This will run Jupyter Notebook on 126.96.36.199:9000
For the files used in this example, see our GitHub repository at:
Join Our Mailing List
Overview With CentOS 7 reaching end of life on June 30th, 2024 and CentOS 8 already discontinued in favor of CentOS Stream, users of open source SingularityCE might find themselves in a situation where a migration to another open source operating system is necessary....
With the ever increasing adoption of AI techniques in scientific research, as well as growing use of accelerators for traditional numerical workloads, easy access to GPUs and other devices in HPC environments is critical.The 4.0 release of the SingularityCE container...
Transforming Alzheimer’s Research with Singularity Containers: A Milestone in Scientific Reproducibility
Addressing The Grand Challenges of Our Time Through Singularity Container TechnologyAt Sylabs, our mission and vision aren't just statements on a wall, they're an ethos we embody daily. We're committed to facilitating cutting-edge research that seeks to address...