Panel |
---|
title | On Nimbus, you can run Jupyter Notebook interactively. It requires three main steps: |
---|
|
|
This is an example of what can be achieved on Nimbus Research Cloud. The detailed configuration for various VM flavours and OS configurations might differ. Nimbus users are responsible for managing their VMs and installing tools. We believe that this step-by-step example might be helpful to run Jupyter Notebook interactively.
Open port 8888 on Nimbus dashboard
From the Nimbus dashboard:
1. | Navigate to Network > Security Groups: | |
2. | Click on + Create Security Group, name it 'port 8888' and then select the Create Security Group button: | |
3. | Select + Add Rule: | |
4. | Then enter the port number 8888 under 'Port', and click on the Add button: | |
5. | Navigate back to Compute > Instances, then click on the arrow down button for the your instance, and select Edit Security Groups. Ensure that you select the port 8888 security group that you have just created, i.e. it should appear on the right hand side list of Instance Security Groups: | |
Run the Jupyter Notebook command
On your Nimbus instance terminal:
Note |
---|
The following command assumes that you have Singularity installed. All Pawsey images have Singularity pre-installed. If you need to install Singularity, see the documentation here. |
Identify the Jupyter base notebook container (latest)
The Jupyter Notebook container is available from this path:
Note |
---|
If you are not using the Nimbus image 'Pawsey Bio - March 2023 - Ubuntu 22.04', you will need to install cvmfs: Code Block |
---|
git clone https://github.com/PawseySC/Pawsey-CernVM-FS.git
cd Pawsey-CernVM-FS
sudo ./install-cvmfs.sh install |
|
Code Block |
---|
$ ls -la /cvmfs/containers.pawsey.org.au
total 3011026
drwxr-xr-x 2 cvmfs cvmfs 4096 Oct 21 08:34 .
-rwxrwxr-x 1 cvmfs cvmfs 1565868032 Mar 8 01:58 datascience-notebook_latest.sif
-rwxrwxr-x 1 cvmfs cvmfs 1517416448 Mar 8 02:13 datascience-notebook_python-3.8.sif |
Note the absolute path of the container (/cvmfs/containers.pawsey.org.au/datascience-notebook_latest.sif
) for the next step.
Alternatively, you can also pull the container to your instance if you prefer to: singularity pull docker://jupyter/datascience-notebook:latest
(but ensure to change the path of the container in the following commands).
Run the Jupyter Notebook command as follows
Here we are using the latest container, which is running Python 3.10:
Code Block |
---|
$ singularity exec -B /data,:/home/joyvan -B /usr /cvmfs/containers.pawsey.org.au/datascience-notebook_latest.sif jupyter notebook --ip='0.0.0.0' --port=8888 --no-browser --allow-root |
singularity exec
invokes the container to run the rserver command.- -B is a flag used to for bind-mounting
/data
, which is a directory on your instance you would like the notebook contents to be stored. - You can replace /data with a directory of your choice, or add more as a comma separated list of the folders you would like the container to have access to, as long as it has user ownership.
- Do not remove
-B /usr
from the bind-mount list as it is required for the notebook to run from the container
If you would like to run the notebook in the background and still access it while you are not logged into your instance, run it with 'nohup':
Code Block |
---|
$ nohup singularity exec -B /data,:/home/joyvan -B /usr /cvmfs/containers.pawsey.org.au/datascience-notebook_latest.sif jupyter notebook --notebook-dir=/data --ip='0.0.0.0' --port=8888 --no-browser --allow-root &
nohup: ignoring input and appending output to 'nohup.out'
|
- Again, replace
/data
accordingly.
You should see an output with how to access the notebook (if run with nohup, the token will be in nohup.out
). Take note of the token, and follow the next step.
Note |
---|
When using Singularity, if you run into an issue with no loop devices found , please use the solution provided here: Using Containers#Commonissues |
Open Jupyter Notebook
- Open up a browser window (IMPORTANT: Firefox does not work. Use Chrome or Safari.)
- Go to your instance with the IP address and 8888 port, e.g. http://146.118.XX.XX:8888
- Use the token that is provided from the previous step
- Ensure you are in the folder /
data
so that all your work will be saved on the /data
folder of your instance Start creating a new notebook and begin your work!
Note |
---|
|
If you have installed modules while running the notebook, they are reflected on your instance, and you would need to append your library/module path(s) to add the relevant directory(ies), for e.g. if you are using Python 3.10: Code Block |
---|
import sys
sys.path.append('/usr/lib/python3.10')
sys.path.append('/usr/local/lib/python3.10') |
|
Note |
---|
|
You may also have a different version of Python on your instance, to the one on the container. Ensure that they are the same versions by updating the one on your instance, or choosing a container that has the same version of Python as the one on your instance. The Pawsey containers repository (/cvmfs/containers.pawsey.org.au ) has a Jupyter Notebook container of both versions of Python, i.e. Python 3.8 and Python 3.10 (latest). |
To check for current running Jupyter notebooks, run the following:
Code Block |
---|
$ singularity exec /cvmfs/containers.pawsey.org.au/datascience-notebook_latest.sif jupyter notebook list
Currently running servers:
http://0.0.0.0:8888/?token=e2749daaa12d8d9d9029d2cb21be9f9ac8b76264ece50116 :: /data |
To stop the notebook on port 8888:
Code Block |
---|
$ singularity exec /cvmfs/containers.pawsey.org.au/datascience-notebook_latest.sif jupyter notebook stop 8888 |