Installing ipython notebook to replace matlab
Here is a recipe for installing the amazing ipython notebook. This is for Ubuntu 10.04 Lucid:
virtualenv ~/pyenvs/notebook source ~/pyenvs/notebook/bin/activate #install zeromq using these hints: http://johanharjono.com/archives/633 sudo apt-get install python-software-properties sudo add-apt-repository ppa:chris-lea/zeromq sudo add-apt-repository ppa:chris-lea/libpgm sudo apt-get update sudo apt-get install libzmq1 sudo apt-get install libzmq-dev sudo apt-get install libpgm-5.1-0 pip install pyzmq pip install tornado pip install --upgrade ipython pip install numpy pip install matplotlib |
Now, we want to create a profile for running a notebook server on a public port. Use this command:
ipython profile create nbserver |
This will create a directory named ~/.ipython/profile_nbserver
with a bunch of files in it. Since we are running public mode, we need a hashed password. Generate one like so:
In [1]: from IPython.lib import passwd In [2]: passwd() Enter password: Verify password: Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed' |
Now edit the file named ~/.ipython/profile_nbserver/ipython_notebook_config.py
. This file will already be populated by a lot of configuration, most of which is commented out. You will want to uncomment/edit these lines:
c = get_config() # When disabled, equations etc. will appear as their untransformed TeX source. c.NotebookApp.enable_mathjax = True # The string should be of the form type:salt:hashed-password. c.NotebookApp.password = u'sha1:xxx:yyyyy' #from above # The IP address the notebook server will listen on. c.NotebookApp.ip = '*' # Pre-load matplotlib and numpy for interactive use, selecting a particular # matplotlib backend and loop integration. c.IPKernelApp.pylab = 'inline' |
Also, you might want these:
c.NotebookApp.certfile = u'/absolute/path/to/your/certificate/mycert.pem' c.NotebookApp.open_browser = False |
Now, start your server like so:
ipython notebook --profile=nbserver |
Connect to your server with firefox, and you should be good to go!
raj 5:32 am on February 11, 2012 Permalink |
Even Visual Studio has inline matplotlib graphs now!
http://pytools.codeplex.com/releases/view/76091
raj 8:26 pm on March 19, 2012 Permalink |
Mac install instructions:
http://minrk.posterous.com/install-ipython-qtconsolenotebook-on-osx-lion
raj 6:51 am on March 21, 2012 Permalink |
installing a modern numpy and matplotlib is crazy hard. used git repos for each.
numpy instructions from here: http://blog.hyperjeff.net/?p=160
the env vars helped me build numpy 1.6.1, but unit tests fail. ugh.
I used matplotlib build steps from the included make.osx file.
tymm 9:43 pm on March 21, 2012 Permalink |
To quickly generate an ssl key via openssl (based on instructions from http://www.madboa.com/geek/openssl/#cert-self )
$ mkdir ~/.ipython/profile_nbserver/ssl
$ cd ~/.ipython/profile_nbserver/ssl
$ openssl req -x509 -nodes -days 365 -subj ‘/C=US/ST=California/L=San Francisco/CN=NA’ -newkey rsa:2048 -keyout ipynb.pem -out ipynb.pem
(feel free to change the argument to -subj as best suits your organization)
then use the aforementioned c.NotebookApp.certfile setting in ipython_notebook_config.py to tell ipython notebook to look for it there.
od1 4:15 pm on March 27, 2012 Permalink |
Great writeup — thanks for posting. I had to install the following w support libraries to get matplotlib to compile:
apt-get install libfreetype6-dev libpng-dev
Mark 1:39 am on September 3, 2012 Permalink |
These instructions worked well. Thank you. I had to add an sudo in front of the “pip install xxxx” instructions to make it work.
raj 3:05 am on September 12, 2012 Permalink |
You can also use virtualenv if you don’t have sudo privileges, or if you want to isolate your ipython installation from the rest of the system packages.
drnealaggarwal 8:36 am on October 24, 2012 Permalink |
Thanks for this Raj. Works brilliantly on Linux Mint 12 only had to sudo the pip commands. Neal
cbellingan 7:32 am on November 29, 2012 Permalink |
Thanks for the info, there were a couple of extra deps for the Ubuntu 12.04 AMI running in EC2, full instructions:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/zeromq
sudo add-apt-repository ppa:chris-lea/libpgm
sudo apt-get update
sudo apt-get install libzmq1
sudo apt-get install libzmq-dev
sudo apt-get install libpgm-5.1-0
sudo apt-get install python-pip
sudo apt-get install gcc
sudo apt-get install python-dev
sudo apt-get install g++
sudo apt-get install libpng-dev libjpeg8-dev libfreetype6-dev
sudo pip install pyzmq
sudo pip install tornado
sudo pip install –upgrade ipython
sudo pip install numpy
sudo pip install matplotlib
Gavin 4:45 am on January 10, 2013 Permalink |
I have automated the set of instructions for ipython notebook using Puppet scripts in a virtual machine. This reduces the installation to just 4 step. I have a github repository that has the code with installation instructions
https://github.com/gavinln/stats_py_vm