Assignment 0 - Jupyter Notebook SetupThis assignment consists of setting up Jupyter (iPython) notebooks on your computer to prepare for Assignment 2, and for later parts of the course. While we feel confident everyone will be able to get the notebooks set up, there can be glitches so we want to ensure everyone is ready to go with plenty of time.
To Do: Once Jupyter is installed, load this test notebook that we have created, and verify that you are able to run every command in that notebook. Take a screenshot and upload proof that you managed to set up the Notebook (with no error messages).
Due Date: Sun Apr 9. There are NO LATE DAYS for this assignment -- we expect all students to have their installation verified by the deadline.
Installation Help: Installing Jupyter can be system-dependent, and you may run into unexpected errors that you aren't able to cope with on your own.
- We will have office hours after class on Apr 6 Thursday 3-430pm in Lathrop Tech Lounge to help students troubleshoot their installations.
- You can also scroll to the bottom for the troubleshooting section.
- Post your question on Piazza, we will do our best to help you. It is difficult to debug online at times.
Here are some basic steps to install Jupyter on your laptop. Please ask any questions on errors that you're encountering. Choose from one of the following installation options:
- Installing Jupyter on Your Mac OS X Laptop Using A Script (FOR MAC USERS RECOMMENDED)
- Installing Jupyter on Your Mac OS X Laptop Manually (FOR MAC USERS)
- Installing Jupyter on Windows (FOR WINDOWS USERS)
1. Installing Jupyter on Your Mac OS X Laptop Using A Script (Recommended)
Here's a script that we wrote that you could try running on your Mac OS X laptop. We've verified that it works to some extent in Yosemite, El Capitan and Mac Sierra. It will outline what it's going to do before actually doing it, so it's safe to run. To run, just download it to some directory, open up Terminal, and run:
- This might take a while, especially if your /usr/local directory has lots of files already.
- If you see messages on installing command line tools, just install the command line tools and re-run the script again!
After you've done this, go to Steps 5 and 6 of the instructions below on how to run the notebook!
2. Installing Jupyter on Your Mac OS X Laptop Manually
Step 1: Install python, pip, and Homebrew:
These are really good things to have installed. Homebrew is very recommended especially if you have El Capitan; if you have Yosemite, you might be able to get by using the system Python, but if you have El Capitan, you'd be much better off using Homebrew Python.
- Python: This should come installed on most systems (try running "python" in your command line / terminal), however if not see here
- pip: If you have Python 2.7.9 or a later version of Python 2.7, you should have pip installed already. But if not, see instructions here
- Homebrew: See instructions here
Step 2: Ensure you have Command Line Tools installed:
After running the command above, a dialog box should open up, which you can follow to install the required components. If a message shows up saying something's already installed, just go on ahead.
Step 3: Install Homebrew Python:
Make sure you have installed Homebrew, and run:
brew install python
Step 4: Install Jupyter notebook:
Make sure you have installed Homebrew python, and run
pip install --upgrade jupyter ipython-sql matplotlib
Step 5: Running Jupyter notebooks:
Download the test notebook that we have made into some directory. In a Terminal, move into the directory where the downloaded notebook is, and run:
Step 6: Hello world:
To confirm that everything is working, download the test notebook, unzip it to the directory you ran the Jupyter notebook, and open by clicking on it in the newly opened browser tab. Click the top cell of the test notebook, and keep pressing Shift+Enter. Verify that you're seeing the correct output in the output cells for each input cell in the test notebook. Once you're done, come visit the TAs or Professor Widom after class or during OH and get yourself checked off for Assignment #2 Prerequisites.
The way it looks should somewhat represent the picture below, but not exactly.
Fig. 1: A notebook is for creative writing!
For (much) more detail about Jupyter notebooks, see the documentation.
3. Installing Jupyter on Windows
Install Python 2.7 Anaconda for Windows 64-bit at this link: https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda2-4.0.0-Windows-x86_64.exe . This is a huge file, so it might take a while.
Run the .exe file and follow instructions to install it, when prompted, make sure the box for "Add Anaconda to my PATH environment variable" is checked and click "Install"
Open the "Command Prompt" application (for older version of Windows, this may be called the "cmd" application instead) and type:
pip install ipython-sql
Note: This step is how you open up your jupyter notebook for future assignments!
In the "Command Prompt" application, type:
In the web browser that was automatically opened, click "New"
Select "Python 2" in the drop down menu to test creating a new notebook. After finished, return to the previous page.
Step 7. Hello world:
To confirm that everything is working, download test notebook .
Find the notebook you just downloaded in your file directory, and click "Open".
Click the blue "Upload" button to complete it.
Now, you can see "Assignment0.ipynb" on your web browser, double click on it to open it. Click the top cell of the test notebook, and keep pressing Shift+Enter. Verify that you're seeing the correct output in the output cells for each input cell in the test notebook.