Python and Jupyter Notebooks Setup

Step 1: Miniconda Download (for Windows)

Data Science requires a few tools to help us discover interesting features in our data. We will primarily use this tool and several libraries within tool:

  • python, a simple programming language (this allows for the computer to do the work for us)

All of these tools are free (and open-source), so it just takes a few minutes for you to install them to get started!

Installing Python

You will need Python 3.6 (or later). We will first check if you have Python already (if you have done Data Science) and install it if you don’t already have it.

Checking for existing Python

  1. Open up your command prompt
  2. Type python --version and press Enter.
  • If you see Python 3.7.1 (or similar), you are all set – no need to install Python. (Skip to the git section.)
  • If you see 'python' is not recognized as an internal or external command, operable program or batch file., install it now:

Installing Python

  1. Visit https://conda.io/miniconda.html to get Miniconda, a light-weight version of the python programming language
  2. Download and install the latest Windows, 64-bit installer for the latest version of Python (eg: 3.7).
  3. After the install finishes, exit your command prompt, re-launch it, and verify it installed by following the steps above (in "checking for existing python").

 


Step 1: Miniconda Download (for Mac OS X)

Data Science requires a few tools to help us discover interesting features in our data. We will primarily use this tool and several libraries within tool:

  • python, a simple programming language (this allows for the computer to do the work for us)

All of these tools are free (and open-source), so it just takes a few minutes for you to install them to get started!

Installing Python

You will need Python 3.6 (or later). We will first check if you have Python already (if you have done Data Science) and install it if you don’t already have it.

Checking for existing Python

  1. Open up your command prompt
  2. Type python --version and press Enter.
  • If you see Python 3.7.1 (or similar), you are all set – no need to install Python!
  • If you see an error or Python 2.7, we will install it now!

Installing Python

  1. Visit https://conda.io/miniconda.html to get Miniconda, a light-weight version of the python programming language
  2. Download the latest Mac OS X, 64-bit bash installer for the latest version of Python (eg: 3.7).
  3. Open up your command prompt and run the script you downloaded by running the following:

cd Downloads

bash Miniconda3-latest-MacOSX-x86_64.sh

You will need to press q to exit the license screen and all default options are fine.

  1. Restart your terminal

 

Step 2: Installing Python Packages

In Data Science, all of our programming will be done in “notebooks”. Your python install will need a few libraries in order to run the notebooks. Using your command line, run the following:

conda install jupyter
conda install pandas
conda install matplotlib
conda install seaborn

Potential Error Workaround: IF you get an error about "conda not found" when trying to do this, you can also install these packages by doing the following.

  • Searching for the "miniconda" program you just downloaded, and run what should say "Anaconda Prompt."
  • This will open up another command line window that is specifically for running python commands (for instance commands that install packages).
  • Run the code in this Anaconda Prompt instead
    conda install jupyter
    conda install pandas
    conda install matplotlib
    conda install seaborn
    

This might take a couple of minutes. You will need to type [y] to confirm you want to install of of the packages (the option [y]/n shows that y is default when you choose no option).

You can check what has been installed already using the command:

conda list


Step 3: Opening Jupyter Notebooks

One way to open the notebook (may not work)

Open the notebook with the command:

jupyter notebook

Another way to open the notebook: IF you get an error about "jupyter is not recognized" when trying to do this, you can also open the notebook by doing the following.

  • Searching for the "miniconda" program you just downloaded, and run what should say "Anaconda Prompt."
  • This will open up the Anaconda Command Line window that is specifically for running python commands (for instance commands that install python packages or launch jupyter notebooks).
  • If your Anaconda Command line window is not already there, navigate to your stat430 repository (cd Desktop -> cd stat430
  • Run the code in this Anaconda Command Line Prompt window instead
    jupyter notebook
    

Also another way to open the notebook:

  • Search for the the program "jupyter" on your computer and run it.
  • This will open a window that displays the file system of your computer. Navigate to the folder your notebook is saved in by clicking on the folder links.
  • Once you've found your notebook, click on it to open it

Step 4: Editing Jupyter Notebooks

Inside of the notebook webpage:

  • Navigate into the folder containing the jupyter notebook in the zip file that you downloaded from the first class and try to run all the code blocks.