Running a Jupyter notebook in SAP Business Application Studio
In this short blog post, I will share how you can set up your SAP Business Application Studio dev space to run Jupyter notebooks 📓.
I personally enjoy working on Jupyter notebooks. It is a quick and simple tool that comes in very handy when exploring data or as a playground to test some python code.
Before we are able to run Jupyter notebooks in SAP Business Application Studio, we need to install pip. pip is the package installer for Python and we will use it to install some publicly available packages. The SAP Business Application Studio requires pip in order to be able to install ipykernel, which is need to run the notebook within the environment.
In the video above, I demo all the steps mentioned below to run Jupyter notebooks 🐍 within the SAP Business Application Studio.
Steps shown in the video:
- Open the terminal (F1).
- Download pip, install it, add its location to PATH, and then proceed to install the hana-ml and hdbcli python packages which will be imported later in the notebook.
# Download the get-pip script, install it, add the install location to your PATH $ curl https://bootstrap.pypa.io/get-pip.py > get-pip.py && python3 get-pip.py && echo "export PATH=/home/user/.local/bin:$PATH" >> .bashrc && source ~/.bashrc # Install hana related python packages $ pip install hdbcli hana-ml shapely
- Install the python and Jupyter extensions which are very useful when using Jupyter notebooks.
- Create a notebook and run some simple python code to install and run ipykernel. This package provides the IPython kernel for Jupyter.
x = 1 + 2 print(x)
- Import the previously install hana-related packages.
from hana_ml import dataframe from hdbcli import dbapi
What I like about the SAP Business Application Studio is how flexible it can be as a development environment. There is no out-of-the-box python dev space? Not a problem you can set it up yourself.
I hope you find this quick blog post useful and that it enables you to use Jupyter notebooks within your dev spaces.