Skip to content

Commit d1568e2

Browse files
Merge branch 'james_quant_summit_demos' into 'master'
James quant summit demos See merge request qs/oreswig!49
2 parents 3316932 + 572bf00 commit d1568e2

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

tutorials.00.index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ ORE python wrappers and wheels.
1414

1515
[Managing Wheels](tutorials.05.wheels.md)
1616

17+
[Run Jupyter Notebook Examples using the published ORE Python module](tutorials.06.notebooks.md)
18+

tutorials.06.notebooks.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Run Juyper Notebook examples using the ORE Python wheels
2+
3+
This tutorial is aimed at the user who wants to install the pre-built ORE
4+
Python module and use it to execute example Jupyter notebooks provided in
5+
[the notebooks directory](https://github.com/OpenSourceRisk/ORE-SWIG/tree/master/OREAnalytics-SWIG/Python/Examples/Notebooks). No compilation is necessary.
6+
7+
[Back to tutorials index](tutorials.00.index.md)
8+
9+
**Please note** that (as of October 2023) the published ORE Python wheels are
10+
available for Python versions 3.8 up to 3.11 for Windows, Linux and macOS arm64,
11+
and Python versions up to 3.10 for Intel Mac users.
12+
13+
We assume below that the python executable points to a permissible Python 3 version. You can check your system's default python version with
14+
15+
python --version
16+
17+
## Quick Set Up and First Run
18+
19+
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.
20+
21+
1. Create a virtual environment:
22+
23+
``` python -m venv venv ```
24+
25+
2. Activate the virtual environment:
26+
27+
(Windows): ```.\venv\Scripts\activate.bat ```
28+
29+
(Linux, Mac): ```source "$(pwd)/venv/bin/activate" ```
30+
31+
3. 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.
32+
33+
``` python -m pip install open-source-risk-engine matplotlib pandas plotly jupyter_server==2.8.0 jupyter ```
34+
35+
4. 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.
36+
37+
``` python -m jupyterlab ```
38+
39+
## Normal Usage
40+
41+
After the first time run, you simply need to activate the virtual environment and run jupyter lab.
42+
43+
(Windows): ```.\venv\Scripts\activate.bat ```
44+
45+
(Linux, Mac): ```source "$(pwd)/venv/bin/activate" ```
46+
47+
python -m jupyterlab
48+
49+
## Exit the virtual environment
50+
51+
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:
52+
53+
(Windows): ```.\venv\Scripts\deactivate.bat ```
54+
55+
(Linux, Mac): ```source "$(pwd)/venv/bin/deactivate" ```
56+

0 commit comments

Comments
 (0)