Running Jupyter notebooks on local machines

Body

Quick start

conda install jupyter
  • In a terminal window (macOS and Linux) or an Anaconda Prompt (Windows) type jupyter notebook This will launch a Jupyter notebook environment in your default browser.

Background

The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

At Dartmouth, Jupyter is commonly used to interactively develop Python and R programs, but it is a versatile and extensible environment that is capable of running a broad array of languages, including C/C++, Java, Go, Matlab, and many more.

You can read more about the project at jupyter.org.

Installing conda

The most straightforward way to install and start using a Jupyter environment is through the Anaconda distribution, which is an open-source Python distribution that includes the conda package manager that makes installing, maintaining, and upgrading Python and R environments straightforward.

Detailed installation instructions found at Anaconda.com are linked below:

Managing packages with conda

We are only listing a few of the more useful commands here. You can add --help to the end of any conda command to get some help on how to use it.

Complete documentation for conda can be found at https://conda.io/projects/conda/en/latest/.

  • conda create – make a new environment
  • conda env remove – remove an existing environment
  • conda info -envs – show environments
  • conda install <package name> – add a package to an environment
  • conda remove <package name> – remove a package from an environment
  • conda list – show packages installed in an environment
  • conda search <package name>– show available packages
  • conda activate <environment name> – activate (use) an environment
  • conda deactivate – deactivate an environment

Installing conda packages into an existing environment

Using the conda install command, you can request multiple packages on the command line and specify (or not) a version for each one. Here is an example of installing a specific version of the numpy package and whatever is current for the ldap3 package into the myenv environment.

Note: part of what conda does dependencies so you would also be installing a couple dozen packages required by numpy and jupyter, if you run this command:

conda install numpy=1.16.2 jupyter

 

How do I know if a package is available?

Use the conda search command for this or search for the package on Anaconda.org. You will find that a vast majority of the Python packages are supported by Anaconda or one of the community maintained channels.

Installing Jupyter

Since Jupyter is merely a Python package, you can use conda to simply install Jupyter as follows:

conda install jupyter

This will install the latest Anaconda supported versions of Jupyter and Python along with all the necessary dependencies.

Launching Jupyter

Windows

From the Start menu, search for and open “Anaconda Prompt”:

macOS

Open Launchpad, then click the terminal icon.

Linux

Open a terminal window.

Running Jupyter notebook server

Now that you have a terminal or Anaconda Prompt window open, to launch a Jupyter notebook server type jupyter notebook.

This will automatically open a new web browser window or tab and show the Notebook Dashboard:

Details

Details

Article ID: 127558
Created
Mon 2/8/21 7:21 PM
Modified
Fri 7/21/23 9:33 AM