This article describes how to use Jupyter Notebook, a powerful web interface for Python, with the REVEN Python API.
To use Jupyter with REVEN, you will need to install Jupyter Notebook (if it is not already installed), and then create a Jupyter kernel for the REVEN Python API.
The procedure below describes how to install Jupyter Notebook in a dedicated virtual environment, but it could also be installed in your system-wide Python installation at your convenience.
1. Create a new virtual environment:
$ python3 -m venv --system-site-packages "jupyter" $ source jupyter/bin/activate
2. Inside of this virtual environment, install Jupyter, and then leave the virtual environment:
(jupyter) $ python -m pip install jupyter (jupyter) $ deactivate
3. Enter REVEN’s virtual environment:
$ cd <path-to-reven-installation> $ source sourceme_python3
4. From within REVEN’s virtual environment, install “jupyter kernel”:
(reven2-env3) $ python -m pip install ipykernel (reven2-env3) $ python -m ipykernel install --user --display-name reven-2.4.0-python3 (reven2-env3) $ deactivate
5. Enter jupyter’s virtual env, and start jupyter notebook:
$ source jupyter/bin/activate (jupyter) $ python -m jupyter notebook
6. Click on the link that should appear in your terminal. From there, notebooks created with the
reven-2.4.0-python3 kernel can
import reven2 to use the API.