iPython notebook

How to install Python, IPython, and IPython Notebook

Note: Shortcuts. A keyboard shortcut, such as pressing the ‘control’ and ‘o’ keys, will be shown as press CTRL+O. Windows as an extra key, the WIN key, and Mac has the COMMAND key.

Note: Typing. Lines you should type will appear in quotes, but please don’t type the quotes, such as “exit” means typing the letters e-x-i-t then pressing enter. Be mindful of letter case and spaces that may appear within these quotes.

Important: See the “How To” sections at the end for how to perform common operations on your operating system such as how to open a terminal, or how to activate your python environment for cse801.

Installation for Mac/Linux

===================

1) Download Miniconda install script for Python 2.7. If you don’t know if you need 64-bit or 32-bit, then choose 32-bit.. We assume you’ve downloaded it to your Downloads directory.

* download from http://conda.pydata.org/miniconda.html

2) Open a terminal

3) Navigate to downloads directory within the terminal

* type “cd Downloads”  (cd stands for Change Directory to)

4) Run the install script, which was written in BASH, by invoking it with BASH. Use tab-completion to save your fingers: After typing “minico” in the following line press TAB and let your fingers be happy as the shell knows to complete the rest for you.

* type “bash Miniconda-3.6.0-MacOSX-x86_64.sh

Sometimes the miniconda MacOSX package becomes updated and you get a newer version (say 4.5.6) then you need to use the name of the new package, the above is an example.

5) It will ask for you to read a license. As you begin reading, you may skip to the end by

* pressing SHIFT+G

Be sure to accept the license agreement by

* typing “yes

Accept all the defaults by just

* pressing ENTER

when asked a question.

6) When it’s all done

* close the terminal

* open a terminal

This forces a refresh of the newly installed software.

7) Create a new python environment for this class, while installing all necessary software.

* type “conda create -n cse801 ipython-notebook numpy matplotlib pandas

8) You will be presented with a list of packages which will be installed as prerequisites.

* press ENTER

9) Done! When it’s finished, go to the How To Try Out IPython Notebook part of this tutorial to see it work.

Installation for Windows (XP / 7 / 8 / 9?)

====================

1) Download Miniconda install script for Python 2.7 (not 3). If you don’t know if you need 64-bit or 32-bit, then choose 32-bit. We assume you’ve downloaded it to your Downloads directory.

* download from http://conda.pydata.org/miniconda.html

2) Install Miniconda by executing the downloaded file and accepting all defaults until it’s done.

3) Open a terminal

4) Create a new python environment for this class, while installing all necessary software.

* type “conda create -n cse801 ipython-notebook numpy matplotlib pandas

you see the term cse801 in there, this is a particular class we taught, if your class is different use an appropriate name, your instructor uses the name jupyter

8) You will be presented with a list of packages which will be installed as prerequisites.

* press ENTER

9) Done! When it’s finished, go to the How To Try Out IPython Notebook part of this tutorial to see it work.

How How to Open a Terminal

======================

Windows

* press WIN+R

* type “cmd

Mac

* press COMMAND+SPACE

* type “terminal

How to Activate Your Python Environment for CSE801

=========================================

Windows

* open a terminal

* type “activate cse801

Mac

* open a terminal

* type “source activate cse801

How to Try Try Out IPython Notebook

===============================

1) Open a terminal

2) Activate your python environment for CSE801

3) Start the IPython Notebook personal web server.

* type “ipython notebook --pylab=inline

On many systems this causes an error, you then need to do this instead:

* type “ipython notebook

and insert the following into the first cell of your new notebook:

%pylab inline

4) In your browser, which may have popped up automatically

* navigate to “localhost:8888

5) In the IPython Notebook page

* click New Notebook

6) In the single blank line of your new notebook

* type “from numpy import *
* type “hist(randn(1000),bins=50);

* press CTRL+ENTER to run your code and see the output histogram of uniform random numbers.

Cheers Jory