5

Running a Jupyter notebook in SAP Business Application Studio

 2 years ago
source link: https://blogs.sap.com/2023/02/08/running-a-jupyter-notebook-in-sap-business-application-studio/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
February 8, 2023 1 minute read

Running a Jupyter notebook in SAP Business Application Studio

1 5 187

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:

  1. Open the terminal (F1).
  2. 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​
  3. Install the python and Jupyter extensions which are very useful when using Jupyter notebooks.
  4. 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)​
  5. 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.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK