BinAC/Software/Jupyterlab: Difference between revisions
F Bartusch (talk | contribs) No edit summary |
F Bartusch (talk | contribs) No edit summary |
||
Line 98: | Line 98: | ||
[[File:Binac_jupyterlab_browser_lab.png | 800px | center ]] |
[[File:Binac_jupyterlab_browser_lab.png | 800px | center ]] |
||
== Access <code>/beegfs/work/</code> in file browser == |
|||
Jupyterlab's root directory will be your home directory. As your home directory is backuped daily you may want to store your notebooks there. |
|||
In order to access data in your workspace (e.g. somewhere under <code>/beegfs/work</code>) via the file browser you will need to create a symbolic link from your home directory to you workspace: |
|||
<pre> |
|||
ln -s /beegfs/work/<path to your project data> $HOME/<link name> |
|||
<pre> |
|||
Through that link in your home directory you can move around your research data in Jupyterlab's file explorer. |
|||
Here is an example how I linked to my directory: |
|||
[[ File:Binac_jupyterlab_link.png | 800px | center ]] |
|||
== Shut Down JupyterLab == |
== Shut Down JupyterLab == |
||
Line 104: | Line 121: | ||
Please note that this will also terminate your compute job on the BinAC! |
Please note that this will also terminate your compute job on the BinAC! |
||
[[File: |
[[File:Binac_jupyterlab_link.png | 800px | center ]] |
||
= Managing Kernels = |
= Managing Kernels = |
||
Line 136: | Line 153: | ||
Refresh the JupyterLab broswer tab and the kernel should now appear in the JupyterLab user interface. |
Refresh the JupyterLab broswer tab and the kernel should now appear in the JupyterLab user interface. |
||
[[File:Binac_jupyterlab_new_kernel.png | 800px | center ]] |
[[ File:Binac_jupyterlab_new_kernel.png | 800px | center ]] |
||
== Remove a Kernel == |
== Remove a Kernel == |
Revision as of 14:59, 26 July 2024
The main documentation is available via |
Description | Content |
---|---|
module load | devel/jupyterlab |
License | JupyterLab License |
Links | Homepage |
Graphical Interface | Yes |
Description
JupyterLab is a web-based interactive development environment for notebooks, code, and data.
Usage
Start JupyterLab
The module provides a job script for starting a JupyterLab instance on the BinAC inter
queue.
Load the module and copy the job script into your workspace:
module load devel/jupyterlab/7.2.1 cp $JUPYTERLAB_EXA_DIR/jupyterlab.pbs.template jupyterlab.pbs
You can adjust the following settings in the job script according to your needs.
#PBS -l nodes=1:ppn=1 # adjust the number of cpu cores (ppn) #PBS -l mem=2gb #PBS -l walltime=6:00:00
Please note the restrictions of the inter queue:
- max. walltime: 12 hours
- max. cores: 28
- max jobs per user: 1
Then submit the job.
jobid=$(qsub jupyterlab.pbs)
Create SSH tunnel
The compute node on which JupyterLab is running is not reachable from your workstation. Hence you have to create an SSH tunnel from your workstation to the compute node through a BinAC login node.
The job's standard output file (Jupyterlab.<jobid>
) contains the SSH command for this tunnel.
Please note that details like IP, port number, and access URL will vary.
cat JupyterLab.o${jobid}
Linux Users
Copy the ssh -N -L ...
command and execute it in a shell on your workstation.
After a successfull authentication the SSH tunnel is ready to use.
The ssh command does not return a result.
If there is no error message everything should be fine:
Windows Users
If you are using Windows you will need to create the SSH tunnel in the SSH client of your choice (e.g. MobaXTerm, PuTTY, etc.).
MobaXTerm
Select Tunneling
in the top ribbon. Then press New SSH tunnel
.
Then configure the SSH tunnel with the correct values taken the SSH tunnel infos above.
For the example in this tutorial it looks as follows:
Access JupyterLab
JupyterLab is now running on a BinAC compute node and you created an SSH tunnel from your workstation to that compute node. Open a browser and copy the URL with the access token into the address field:
Your browser should now display the JupyterLab user interface:
Access /beegfs/work/
in file browser
Jupyterlab's root directory will be your home directory. As your home directory is backuped daily you may want to store your notebooks there.
In order to access data in your workspace (e.g. somewhere under /beegfs/work
) via the file browser you will need to create a symbolic link from your home directory to you workspace:
ln -s /beegfs/work/<path to your project data> $HOME/<link name> <pre> Through that link in your home directory you can move around your research data in Jupyterlab's file explorer. Here is an example how I linked to my directory: [[ File:Binac_jupyterlab_link.png | 800px | center ]] == Shut Down JupyterLab == You can shut down JupyterLab via <code>File -> Shut Down</code>. Please note that this will also terminate your compute job on the BinAC! [[File:Binac_jupyterlab_link.png | 800px | center ]] = Managing Kernels = == Add a new Kernel == There is only a Python 3 kernel installed when you first start JupyterLab. Because there are nearly endless combinations of Python versions and packages we encourage you to install the software yourself via Conda. This is an example how you create new kernels for Jupyterlab. It's so simple that three commmands suffice: <pre> conda create --name kernel_env python=3.8 pandas numpy matplotlib ipykernel # 1 conda activate kernel_env # 2 python -m ipykernel install --user --name pandas --display-name="Python 3.8 (pandas)" # 3 # Installed kernelspec pandas in /home/tu/tu_tu/tu_iioba01/.local/share/jupyter/kernels/pandas
The first command creates a new Conda environment called kernel_env
and installs a specific Python packages plus a few Python packages. It's important that you also install ipykernel
. We need ipykernel
later to create the JupyterLab kernel.
The second command activates the kernel_env
Conda environment.
The third command creates the new JupyterLab kernel. The kernels are stored in your Home directory on BinAC: /$HOME/.local/share/jupyter/kernels/
:
$ ls -lh $HOME/.local/share/jupyter/kernels/ total 0 drwxr-xr-x 2 tu_iioba01 tu_tu 109 Jul 26 10:38 pandas
Refresh the JupyterLab broswer tab and the kernel should now appear in the JupyterLab user interface.
Remove a Kernel
In order to remove a kernel from Jupyterlab, simply remove the corresponding directory in /$HOME/.local/share/jupyter/kernels/
:
# Remove the JupyterLab kernel installed in the previous example rm -rf /$HOME/.local/share/jupyter/kernels/pandas
Also remove the corresponding Conda environment if you don't need it any more:
conda env remove --name kernel_env