Einstein Python | Jupyter Tips

Back to Home

Some tips for working with Jupyter Notebooks

Improve your Jupyter experience!

(Unofficial) Jupyter Notebook Extensions

Some of these extension are a real game-changer and turn working with Jupyter from "good" to "awesome" (personal opinion).

Full documention: Unofficial Jupyter Notebook Extensions

Installation

There are a few steps that I will outline here, links to detailed documentation included:

  1. Open a conda-activated terminal:

    • Anaconda Prompt (Windows)
    • Any terminal on Mac/Linux and execute conda activate

    All following commands are meant to be typed (or copied&pasted) in that terminal.
    Some of them might ask for confirmation, which usually means typing y and then hitting [Enter]. Often, yes is the default response (which is somehow visually indicated) and you can just hit [Enter] to continue.

  2. Add/register the conda-forge channel as a package source for conda (docs)

    conda-forge offers a lot of packages that are not shipped/provided in the official conda repository. We just need to tell conda first that it can use it.

    Execute the following command:

    conda config --add channels conda-forge

    The documentation also includes the following command. However that led to problems with my Anaconda installation. You may try it yourself...

    conda config --set channel_priority strict

    In case you tried it and run into problems with the next command, you can undo it by setting channel_priority back to it's default value flexible:

    conda config --set channel_priority flexible
  3. Installing jupyter_contrib_nbextensions (docs)

    This command installs and enables Jupyter Notebook Extensions:

    conda install -c conda-forge jupyter_contrib_nbextensions
  4. You need to restart Jupyter if it was already running. Otherwise, you can start it now.

  5. Enabling/Disabling nbextensions (docs)

    The easiest way to enable or disable nbextensions is the Jupyter Nbextensions Configurator that you can access in your webbrowser. On your "Dashboard", i.e. the file list that is shown when you start Jupyter, there should be a tab Nbextensions now:

    nbextensions_configurator/tree_tab

    Simply go on that page and you see all the nbextensions that you have available. You can enable/disable them at will and some of them have additional options.

    Note: You may have to uncheck the checkbox near "disable configuration for nbextensions without explicit compatibility..." at the top of the Configurator page. I usually do that and never had a problem.

My favorite nbextensions

Those are the nbextensions I have usually enabled. You may have a different taste or other needs.

You may also give the "Variable Inspector" a try. It's great to see which variables you currently have available. However, we have had some significant performance issues with that in a Notebook with many variables (NumPy, Pandas and Matplotlib objects). I don't remember the exact conditions, but everything was 10x slower with the inspector enabled. Still, for learning purposes in small notebooks, it's cool.

List of provided nbextensions in the official jupyter_contrib_nbextensions docs.