-
Notifications
You must be signed in to change notification settings - Fork 32
Jupyter notebook on Vorna
University of Helsinki IT4SCI has introduced a (beta-version) Jupyter notebook interface. It can be found at https://hub.cs.helsinki.fi and can be accessed only from the internal network or using a VPN.
- Log in with your UH credentials
- Launch a compute task (e.g. 1 day Vorna - make sure you select a task with enough memory). Launching and contacting the server can take some time, so be patient.
- Using the file interface button on the left-hand-side, navigate to your home directory (or to another directory where you have write access to)
- Click on
New Launcher
-Notebook
-Python3
- Now you should have a Python notebook with a title something like
UntitledXX.ipynb
with a command line. Typeimport pytools as pt
and start using Analysator!
NB: A command (cell) is submitted with shift+Enter
The Jupyter environment does not currently include a LaTeX installation, so you should either include export PTNOLATEX=1
in your Vorna ~/.bashrc
or before importing pytools, write
import os
os.environ['PTNOLATEX'] = '1'
Start your jupyterhub and go to file-> New-> terminal
and go to the proj/$USER
directory and create your virtual environment "virtualEnvName"
by typing
python -m venv virtualEnvName
Activate the virtuelEnvName
and start installing required packages and/or packages you want, for example
source /proj/$USER/virtualEnvName/bin/activate
pip install virtualenvwrapper ipykernel matplotlib==3.2.1 scipy
To add analysator in your python virtual environment, type the following in the jupyterhub terminal (virtualenvwrapper
is required here)
source /proj/$USER/virtualEnvName/bin/virtualenvwrapper.sh
add2virtualenv /directory/where/analysator/is/located/analysator
To use the created virtual environment in Jupyterhub, go to the directory where your virtualEnvName is located and type the following in the jupyterhub terminal, a python environment name will appear "MyPythonEnv" in your jupyterhub interface and ready to use
python -m ipykernel install --user --name=virtualEnvName --display-name MyPythonEnv
When you want to use the kernel "MyPythonEnv", you can just click the MyPythonEnv at jupyterhub interface to create jupyter notebook like UntitledXX.ipynb
or change .ipynb
files you already have by using the kernel menu or by clicking Python 3
on the top right corner on the jupyterhub interface.
If somehow you want to remove the python environment completely, first get all the kernels by typing jupyter kernelspec list
and remove the "kernel-to-remove"
kernel by typing jupyter kernelspec uninstall kernel-to-remove
. And finally remove the "virtuelEnvName"
directory
By default, the Python3 notebook uses an inline
backend which creates simple static plots. Alternatively, before importing pytools, you can activate more interactive backends such as %matplotlib widget
or %matplotlib ipympl
(for re-scalable and rotatable 3D plots)