Getting Started with Jupyter Notebooks
Jupyter Notebooks are a way to write and run Python code. By installing Anaconda, you have access to Jupyter Notebooks. They allow you to break up code into “cells” and run these cells individually.
This section will help you get started with accessing, creating, and running Jupyter Notebooks.
- Navigation and package management
- Unix Shell: We can use basic Unix Shell commands to open Jupyter Notebooks. If you are new to the Unix Shell, see this tutorial for learning about the Unix Shell (focus on the introduction and “Navigating Files and Directories” sections): (http://swcarpentry.github.io/shell-novice/)[http://swcarpentry.github.io/shell-novice/]
- For a summary of the key points of the Unix Shell, see (https://swcarpentry.github.io/shell-novice/reference/)[https://swcarpentry.github.io/shell-novice/reference/].
- To navigate around the Unix Shell, these are some basic commands that you will need:
cd
changes your directory cd ..
moves up one level in a directory tree ls
lists your directory * Environment and package management:
conda install
to install a package conda list
to list all installed packages - See the Managing Envrionments documentation for details
- Creating Jupyter Notebooks
- Create a folder to store all files for this class. For example, on Windows computers, I recommend creating the folder under “Windows (C:)” then “Users” then “Your Username”. Do not include spaces in the name of your folder.
- Search “terminal” or “anaconda prompt” in your computer's searchbar to find the Command Prompt or Anaconda Prompt. Open one of these programs.
- Navigate to the folder that you created in step one using the commands provided above in the “Unix Shell” section.
- Open the Jupyter Notebook Interface by typing
jupyter notebook
. - Your command prompt should look similar to this:
- A tab with the Jupyter Notebook interface will open in your browser.
- Create a new Jupyter Notebook by selecting “New” in the upper right hand corner and then “Python 3”.
- You have now created a Jupyter Notebook to run Python code in. The next labs will provide you with some basics of Python coding. See the “Resources to Learn Python Programming” for more, including tutorials, glossaries, and documentation.
- To close the Jupyter Notebook and the interface, save your notebook and return to the interface. Select your notebook and click “Shutdown”. Then, click “Quit” in the upper right hand corner of the interface page. You can now also close the Anaconda Prompt or terminal.
- Opening Existing Jupyter Notebooks
- Follow the steps from the section above to reach the Jupyter Notebook interface.
- You will see all existing Jupyter Notebooks saved to your folder. Click on the notebook that you want to open.
When downloading Jupyter Notebooks, be sure to either save them or move them to your folder for this class.