Anaconda Enterprise: Documentation

# Jupyter Notebook Application (AEN 4.0)

The Jupyter Notebook Application allows the creation and editing of documents that display the input and output of a Python or R language script. Once saved, these files may easily be shared with others.

NOTE: Python and R language are included by default, and with customization the notebooks can run many other kernel/languages.

Anaconda Enterprise Notebooks 4.0 uses Jupyter notebook, 4.2, plus some extensions to make them even more useful including one-click integration with Anaconda Cloud and easy management of conda environments and packages.

This page includes a brief introduction to Jupyter Notebooks and information on using the notebook extensions.

Official Jupyter Notebook user instructions are located in the Jupyter documentation.

To open the Jupyter Notebook application, from your user home page, select the project you want to manage. On the project’s home page, click the Jupyter Notebooks icon.

This brings you to the Jupyter Notebooks Files tab:

TIP: You can see and manage the same file list in the Terminal, Workbench, and Viewer apps.

- Test a sample notebook. The examples folder contains several types of notebook examples in Python and one in R language. Open any example notebook to play with it and see how it works.
- Create a new notebook. From the Files tab, create a new notebook by clicking the top right New button, then select Python [Default], Python [root] or R language.

TIP: By default, your new Jupyter Notebook is saved in the project directory, not your home directory.

## Notebook Extensions

Extensions included in Anaconda Enterprise Jupyter Notebooks include:

- Synchronize Environments with Jupyter from top Kernel menu
- Locking multi-user capability from top menu Lock button
- Revision Control Mechanism (RCM) adds top menu buttons Status, Checkout and Commit
- Conda environment and package management tab
- Conda notebook conda management inside notebook from Kernel - Conda Packages menu
- Anaconda Cloud integration from top menu Publish to cloud button

### Synchronize environments

You can change Python and R-language environments inside a unique notebook session without the need to start up several instances using each of your selected environments. To change environments, from the top menu bar, select Kernel, then Change kernel, and select Python [default] or R [default].

NOTE: In Anaconda Enterprise Notebooks 4.0, the default kernel for projects is `default`. In earlier versions, the default kernel for projects was root Python. This is why you see Python [Root] in the Kernel menu.

TIP: You must have the R language package installed in your environment before you can switch to it.

### Locking

The multi-user capability in the Anaconda Enterprise Notebooks Enterprise experience is engaged when multiple users work in the same notebook file. The notebook is “locked” on opening. If other users later open and try to save the notebook with their own changes, their save capability will be disabled, and they can not overwrite the locked notebook. To override this, they must actively take the lock by clicking the “lock” icon in the notebook toolbar:

NOTE: This is a “soft locking model” so a team member can choose to override a lock to save their work. If you have given team members write access to your files, they should unlock your file only to perform only meaningful (non-destructive) team contributions.

## Revision Control Mechanism (RCM)

The RCM Notebook Extension is simple version control for Jupyter notebook files. It is a notebook extension that uses the internal Jupyter machinery to perform its tasks.

On the surface it is a simple “linear” model, but under the hood is a more complex git-based branched model. It is a model with “the latest wins” as its main “merging” strategy, so by design there are no merge conflicts.

The RCM Notebook Extension adds 3 buttons:

- Status button: See what revision you are on.
- Checkout button: View a list of the previous revision points, check out a previous revision or compare differences between revisions.
- Commit button: Commit the current changes.

TIP: If you do not see the RCM buttons, please see “First time setting up RCM” below.

- STATUS: After clicking the Status button, the following window appears:

- CHECKOUT: After clicking the Checkout button, the following window appears:

> - Checkout a previous revision point. Check the checkbox of the desired revision point and press the “OK” button. This will open a copy of the notebook at the selected revision point. If you have not saved your current window, checking out a previous revision will destroy it. If in doubt, click Cancel, save your work, then revert to a previous revision point.
> - Make a diff comparison. Compare two previous revision points by checking the checkboxes and clicking the “View Diff” button.
> - Cancel to close the current modal window.

- COMMIT: Save or persist the changes. This keeps a permanent record of the changes introduced so you don’t have to worry about losing data or information. You can “roll back” at any time by checking out a previous version you have committed. After clicking the Commit button, the following window appears:

Enter a description of this commit to remind you if you need to revert back to it later. Click the OK button when finished.

First time setting up RCM

If you do not see the RCM buttons in your notebook, go to the project home page and open the Terminal app.

In the terminal run these commands:

    git config --global user.email "you@example.com"
    git config --global user.name "Your Name"

NOTE: Change “you@example.com” to your email address, and “Your Name” to your actual name.

Now open Jupyter Notebook again and refresh, and you will see the RCM buttons.

## Conda integration

The NBConda extension adds a Conda tab to the notebook for easy environment and package management from within the notebook:

Click the Conda tab in a notebook to display:

- Conda environments list. Also export, clone or delete an environment in the action column, or create a new environment by clicking the “+” icon. Switch to an environment by clicking it; packages for that environment are displayed below in the installed packages list.
- Conda available packages list for the selected environment in currently configured channels, search for packages and click a package name to install it.
- Installed packages list in the selected environment, check for updates, update or delete selected packages.

TIP: While you are in any notebook, you can jump to this same conda extension for the current environment by selecting Kernel -> Conda Packages:

### Conda in Notebook view

This extension adds a Conda Packages item to the Kernel menu. Selecting this item displays the list of Conda packages in the environment associated with the running kernel, and the list of available packages. You can perform the same actions as in the Conda tab, but only against the current environment.

## Anaconda Cloud integration

You can now easily upload your notebook to Anaconda Cloud with a simple button at the notebook UI: