Using the Jupyter Notebook environment

This section provides a quick introduction to the Jupyter Notebook environment where you can run Python code in an interactive manner and visualize the output as maps and charts. Refer to the official Jupyter documentation and this quick start guide for further details.

Starting the Jupyter Notebook environment

Once conda and the ArcGIS API for Python is installed, you can start the Jupyter Notebook environment by typing the following command in your terminal.

jupyter notebook

If you are running a Windows OS, this could be your command prompt or PowerShell window. Similarly if you are running a Mac or Linux OS, this could be your terminal. Below is a screen shot of how it would appear if you were running the command from Windows command prompt.

Windows command prompt running jupyter notebook

If you installed the ArcGIS API for Python in a conda environment other than root (which is the default), you need to activate that environment before starting the Jupyter Notebook. For more information on the benefits of using environments and how to create and manage them, refer to this official documentation page.

If you are running a sample notebook for the API, you need to 'cd' into the directory where you downloaded the samples. In the example above, the samples have been downloaded and extracted into c:\code directory.

The command starts Jupyter Notebook and opens it in your default web browser as shown below.

Jupyter Notebook web application

The page you see in this image is called the Notebook Dashboard.

Running the sample notebooks

In the Jupyter Notebook, you can navigate the folder structure and click on a sample notebook. This opens the notebook in a new tab or window. You can run each cell by selecting it and clicking on the 'run cell' button. Alternately, you can run a cell using the keyboard shortcut shift + enter. The animation below shows these steps in action.

running a sample notebook

When a cell is executing the cell number turns to an asterisk (*) and the circle next to the kernal name (Python 3 in the gif above) turns solid.

Creating new notebooks

In addition to running the sample notebooks, you can create new notebooks for your projects. To do so, from the Notebook Dashboard page, click on the 'New' button and select a Python kernel of choice as shown in the image below.

creating new notebooks

Alternately, you can create new notebooks from the 'File' menu of a running notebook. In the screenshot above, note the icons of currently running notebooks are green in color.

Further help and keyboard shortcuts

You can get a tour of the notebook interface from the Help -> User Interface Tour menu. As you get used to this new interface, you can enhance your productivity by learning a few keyboard shortcuts. Accessing Help > Keyboard shortcuts from a running notebook will bring up a help dialog as shown below.

keyboard shortcuts

Among the shortcuts, ctrl + shift + P or cmd + shift + P on a mac is particularly useful as it brings up a command palette into which you can type what you wish to do and execute it. Refer to this blog article Five tips to get you started with Jupyter notebooks to get further understanding on patterns to follow while using Jupyter notebooks.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.