Oddly, although I’ve been using the scientific Python stack for about 10 years, I’ve never jumped on the iPython band-waggon. Well, I’ve fired it up once or twice, but I’ve never really dug into using it. I’ve gotten more curious about the iPython notebook facility (I assume this idea traces back to Mathematica’s notebook nomenclature). Anyway, I decided to see what all the fuss is about (and by fuss, I mean the fact that a large number of folks at SciPy 2013 gave their presentations in iPython or https://www.wakari.io/gallery notebooks. So, here goes.
Obviously, I could start with wakari in about five minutes, but I always like to try to “spin my own” first. I’m on gentoo and I have iPython installed. So, after browsing through the iPython notebook page (linked above), I found the magical incantation:
ipython notebook
As is fairly typical in the roll your own universe, I got an error:
Traceback (most recent call last):
File "/usr/bin/ipython-python2.7", line 9, in <module>
load_entry_point('ipython==0.13.2', 'console_scripts', 'ipython')()
File "/usr/lib64/python2.7/site-packages/IPython/frontend/terminal/ipapp.py", line 388, in launch_new_instance
app.initialize()
<snip> boy error messages are "noisy" </snip>
File "/usr/lib64/python2.7/site-packages/IPython/frontend/html/notebook/__init__.py", line 8, in <module>
raise ImportError(msg)ImportError: The IPython Notebook requires tornado >= 2.1.0
But, a quick emerge -av www-servers/tornado and ipython notebook I was off and running:

A simple click on the New Notebook button:

and I had an (i)python prompt. Part of my goal with this is to experiment with formatting of hybrid text, mathematics, and (mostly python) source code for a book. I have an idea in mind, but much like artistry, I have to figure out (clarify and implement) what I have in my head. Anyway, as a simple example, I’m going to play with some description, mathematics, and code for the time-honored method of linear regression. And for that, I’m going to switch over to my notebook. Hopefully, I’ll be able to share it @http://nbviewer.ipython.org/. I’ll also try the static html export facility to dump it here.
So, it turns out I was a bit ahead of myself. Emerging tornado installed a half-baked, and somewhat broken, MathJax processing. This resulted in some weird “this works, that doesn’t” \(LaTeX\) support. I uninstalled iPython and www-servers/tornado and I made some edits to /etc/portage/package.use:
mfenner [528] % grep dev-python/ipython /etc/portage/package.use
dev-python/ipython -wxwidgets matplotlib examples notebook
The change resulted in a much happier installation.
I dug up (“Googled”) a few resources for editing the notebooks, but the underlying URLs are are a bit ugly (they might break): Rich Display System and Markdown Cells.