We will use the Jupyter notebook to run our Python data analysis in this course. If you’ve successfully installed and activated the environment for this course, the Jupyter notbook package should already be installed.

On this page, I’ll discuss two common issues when starting out with Jupyter notebooks: launching a notebook and ensuring the right files are available.

I strongly encourage you to go through the official documentation for the Jupyter notebook:

Launching a Jupyter notebook

The recommended approach for starting a notebook is to use the Anaconda Prompt on Windows or the Terminal app on MacOS. To do so, we simply need to activate our 'musa-550-fall-2020' environment and then launch the notebook.

From the command line, run:

conda activate musa-550-fall-2020
jupyter notebook

This will create the local Jupyter server and should launch the Jupyter dashboard. If it does not open in a browser, copy the link that is output by the command into your favorite browser. Typically, the server will be running at http://localhost:8080. The dashboard should like look this:

Once the server is running, you can create a new notebook and get started!

A new notebook can be created either from the dashboard, or using the File ‣ New menu option from within an active notebook. The new notebook is created within the same directory and will open in a new browser tab.

Source: Jupyter Notebook documentation

The following shows the basic user interfaces of a Jupyter notebook:

For detailed explanations of these components, see the Jupyter notebook documentation on the user interface. There is also a more detailed section on the user interface components.

Changing the Jupyter notebook start-up folder

By default, the Jupyter notebook launches from the home directory. When you see the Notebook dashboard, you should see all of the files in this folder.

When working with weekly lectures or assignments, it is easiest to open notebooks from the specific assignment or week folder that you are working on.

To do so, it will be easiest to change the directory before launching the Jupyter notebook:

Step 1: Change to the desired directory

Let’s imagine we want to change to a folder named:

/Users/YourUserName/MUSA_550 (on a Mac),

or

C:\Users\YourUserName\MUSA_550 (on Windows)

If you need help finding the folder name’s path, this guide for Windows. (I usually use Method #2). On MacOS, you can use this guide to copy a folder’s path name.

Next, use the following steps:

Step 1. On Windows, open the Anaconda Prompt, or on Mac, open the Terminal.

Step 2. Navigate to the folder where the environment file is located. From the Prompt or Terminal run:

Windows

cd C:\Users\YourUserName\MUSA_550

Mac

cd /Users/YourUserName/MUSA_550/

Step 2: Launch the Jupyter notebook

Now, type the following command, either in Anaconda Prompt or the Terminal:

jupyter notebook

And the launched notebook will start from your desired folder!