Quickstart with a Python Notebook

This tutorial explains how to use a Python virtual environment with the Luminary Cloud SDK to access a pre-written sample notebook in your web browser.

This is the fastest way to get started writing and executing code to run simulations. It’s the best option if you’re looking to quickly get a feel for the Luminary Cloud Python SDK.

Important

If you have never logged in to the Luminary web app, please log in and accept the terms and conditions before proceeding.

Download Files

Clone or download the Luminary tutorials repository from GitHub. This guide uses the Piper Cherokee tutorial notebook.

Caution

To avoid potential problems, make sure there are no spaces in the file path.

For example, do not put the file in a location like this:

C:/My Projects/tutorials

Instead use:

C:/MyProjects/tutorials or C:/My_Projects/tutorials

Environment Setup

Important

It’s highly recommended to use a virtualenv to minimize installation issues and avoid impacting your existing Python environment. However, you can skip this step if you’d like to use an existing Python environment.

Open a terminal inside the tutorials directory that you just created. Follow the steps in Install the Luminary Cloud Python SDK under “Create a Python virtualenv (recommended)” to create and activate the environment.

Now, install the Luminary Cloud Python SDK and other required packages for this tutorial:

python -m pip install -r requirements.txt
py -m pip install -r requirements.txt

Run the Notebook Server

  1. With your terminal in the tutorials directory (and virtual environment activated), start the server:

jupyter lab
  1. A tab should have opened in your browser. If not, look for a URL like this in the command output and open it in your browser (Google Chrome recommended):

http://127.0.0.1:8888/lab?token=...

../_images/notebook_interface.png
  1. In the left-hand sidebar, find a sample notebook called piper-tutorial.ipynb. Double-click to open it.

  2. Continue the quickstart tutorial by following the instructions in the notebook.

To stop the notebook server, save your files and return to the terminal where the notebook server is running. Use CTRL-C to interrupt the process and stop the server.

Using the Notebook Interface

This quickstart tutorial utilizes a pre-made Python notebook to provide a simple way to run and explore simulations. For more information on notebooks, see the JupyterLab documentation.

Manage Files in the Notebook Interface

To upload a file from the host filesystem, click the Upload button at the top of the left-hand sidebar.

../_images/notebook_upload_file.png

Tip

You can also drag and drop files into the sidebar to upload them.