.computecanada.ca}}
In the preceding command substitute
by your username; and substitute
by the cluster you connected to launch your Jupyter Notebook.
Then, copy and paste the provided URL into your browser. In the above example, this would be
http://cdr544.int.cedar.computecanada.ca:8888/?token=7ed7059fad64446f837567e3
=== From Windows ===
An [[SSH tunnelling|SSH tunnel]] can be created from Windows using [[Connecting_with_MobaXTerm | MobaXTerm]] as follows. This will also work from any Unix system (MacOS, Linux, etc).
- Open a new Terminal tab in MobaXTerm (Session 1) and connect to a cluster. Then follow the instructions in section [[#Starting_Jupyter_Notebook| Starting Jupyter Notebook]]. At this point, you should have on your screen an URL with the following form.
http://cdr544.int.cedar.computecanada.ca:8888/?token=7ed7059fad64446f837567e3
└────────────────┬───────────────────┘ └──────────┬───────────┘
hostname:port token
- Open a second Terminal tab in MobaXTerm (Session 2). In the following command, substitute
by its corresponding value from the URL you obtained in Session 1 (refer to the previous figure); substitute
by your username; and substitute
by the cluster you connected to in Session 1. Run the command.
{{Command2
|prompt=[name@my_computer ~]$
|ssh -L 8888: @.computecanada.ca}}
- Open your browser and go to
http://localhost:8888/?token=
Replace
with its value from Session 1.
== Shutting down Jupyter Notebook ==
You can shut down the Jupyter Notebook server before the walltime limit by pressing Ctrl-C twice in the terminal that launched the interactive job.
If you used MobaXterm to create a tunnel, press Ctrl-D in Session 2 to shut down the tunnel.
== Adding kernels ==
It is possible to add kernels for other programming languages or Python versions different than the one running the Jupyter Notebook. Refer to [http://jupyter-client.readthedocs.io/en/latest/kernels.html Making kernels for Jupyter] to learn more.
The installation of a new kernel is done in two steps.
#Installation of the packages that will allow the language interpreter to communicate with Jupyter Notebook.
#Creation of a file that will indicate to Jupyter Notebook how to initiate a communication channel with the language interpreter. This file is called a ''kernel spec file''.
Each kernel spec file has to be created in its own subfolder inside a folder in your home directory with the following path ~/.local/share/jupyter/kernels
. Jupyter Notebook does not create this folder, so the first step in all cases is to create it. You can use the following command.
{{Command2|mkdir -p ~/.local/share/jupyter/kernels}}
In the following sections, we provide a few examples of the kernel installation procedure.
=== Julia ===
- Load the [[Julia]] module. {{Command2|module load julia}}
- Activate the Jupyter Notebook virtual environment. {{Command2|source $HOME/jupyter_py3/bin/activate}}
- Install IJulia. {{Command2|prompt=(jupyter_py3)_[name@server ~]$|echo 'Pkg.add("IJulia")' {{!}} julia}}
For more information, see the [https://github.com/JuliaLang/IJulia.jl IJulia documentation].
=== Python ===
- Load the Python module. {{Command2|module load python/3.5}}
- Create a new Python virtual environment. {{Command2|virtualenv $HOME/jupyter_py3.5}}
- Activate your newly created Python virtual environment. {{Command2|source $HOME/jupyter_py3.5/bin/activate}}
- Install the
ipykernel
library. {{Command2|prompt=(jupyter_py3.5)_[name@server ~]$|pip install ipykernel}}
- Generate the kernel spec file. Substitute
by a name that will uniquely identify your kernel. {{Command2|prompt=(jupyter_py3.5)_[name@server ~]$|python -m ipykernel install --user --name --display-name "Python 3.5 Kernel"}}
- Deactivate the virtual environment. {{Command2|prompt=(jupyter_py3.5)_[name@server ~]$|deactivate}}
For more information, see the [http://ipython.readthedocs.io/en/stable/install/kernel_install.html ipykernel documentation].
=== R ===
- Load the R module. {{Command2|module load r}}
- Activate the Jupyter Notebook virtual environment. {{Command2|source $HOME/jupyter_py3/bin/activate}}
- Install the R kernel dependencies. {{Command2|prompt=(jupyter_py3)_[name@server ~]$|R -e "install.packages(c('crayon', 'pbdZMQ', 'devtools'), repos{{=}}'http://cran.us.r-project.org')"}}
- Install the R kernel. {{Command2|prompt=(jupyter_py3)_[name@server ~]$|R -e "devtools::install_github(paste0('IRkernel/', c('repr', 'IRdisplay', 'IRkernel')))"}}
- Install the R kernel spec file. {{Command2|prompt=(jupyter_py3)_[name@server ~]$|R -e "IRkernel::installspec()"}}
For more information, see the [https://irkernel.github.io/docs/ IRKernel documentation].
== References ==