This tutorial is aimed at the user who wants to install the pre-built ORE Python module and use it to execute example Jupyter notebooks provided in the notebooks directory. No compilation is necessary.
Please note that (as of October 2024) the published ORE Python wheels are available for Python versions 3.8 up to 3.12 for Windows, Linux, macOS arm64, and Intel Mac users.
We assume below that the python executable points to a permissible Python 3 version. You can check your system's default python version with
python --version
Please note that these steps must be executed sequentially in a single command prompt/shell. The working directory, for ease, should be OREAnalytics-SWIG/Python/Examples/Notebooks.
-
Create a virtual environment:
python -m venv venv -
Activate the virtual environment:
(Windows):
.\venv\Scripts\activate.bat(Linux, Mac):
source "$(pwd)/venv/bin/activate" -
Install required Python modules. The notebook examples require Jupyter, the ORE Python module and a few additional packages for e.g. plotting. To install these in the virtual environment please make sure to execute this after activating the virtual environment as above.
python -m pip install open-source-risk-engine matplotlib pandas plotly jupyter_server==2.8.0 jupyter -
Launch Jupyter! This opens a browser window that shows the list of Example folders on the left hand side. Double click to change into any of the Example folders and then double click the Jupyter notebook to open.
python -m jupyterlab
After the first time run, you simply need to activate the virtual environment and run jupyter lab.
(Windows): .\venv\Scripts\activate.bat
(Linux, Mac): source "$(pwd)/venv/bin/activate"
python -m jupyterlab
To deactivate the virtual environment you can simply close the command prompt/terminal window. Othewise you can run the relevant deactivation script (assuming that the working directory is the Notebooks directory:
(Windows): .\venv\Scripts\deactivate.bat
(Linux, Mac): source "$(pwd)/venv/bin/deactivate"