{"id":59,"date":"2013-09-23T16:03:21","date_gmt":"2013-09-23T16:03:21","guid":{"rendered":"http:\/\/drsfenner.org\/blog\/?p=59"},"modified":"2013-09-23T16:03:21","modified_gmt":"2013-09-23T16:03:21","slug":"ipython","status":"publish","type":"post","link":"https:\/\/drsfenner.org\/blog\/2013\/09\/ipython\/","title":{"rendered":"iPython"},"content":{"rendered":"<p>Oddly, although I&#8217;ve been using the scientific Python stack for about 10 years, I&#8217;ve never jumped on the iPython band-waggon. \u00a0Well, I&#8217;ve fired it up once or twice, but I&#8217;ve never really dug into using it. \u00a0I&#8217;ve gotten more curious about the iPython notebook facility (I assume this idea traces back to Mathematica&#8217;s notebook nomenclature). \u00a0Anyway, 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 <a title=\"iPython\" href=\"http:\/\/ipython.org\/ipython-doc\/stable\/interactive\/notebook.html\">iPython<\/a> or\u00a0<a title=\"Wakari\" href=\"https:\/\/www.wakari.io\/gallery\">https:\/\/www.wakari.io\/gallery<\/a>\u00a0notebooks. \u00a0So, here goes.<\/p>\n<p>Obviously, I could start with wakari in about five minutes, but I always like to try to &#8220;spin my own&#8221; first. \u00a0I&#8217;m on gentoo and I have iPython installed. \u00a0So, after browsing through the iPython notebook page (linked above), I found the magical incantation:<\/p>\n<pre>ipython notebook<\/pre>\n<p>As is fairly typical in the roll your own universe, I got an error:<\/p>\n<pre>Traceback (most recent call last):\r\n File \"\/usr\/bin\/ipython-python2.7\", line 9, in &lt;module&gt;\r\n load_entry_point('ipython==0.13.2', 'console_scripts', 'ipython')()\r\n File \"\/usr\/lib64\/python2.7\/site-packages\/IPython\/frontend\/terminal\/ipapp.py\", line 388, in launch_new_instance\r\n app.initialize()\r\n&lt;snip&gt; boy error messages are \"noisy\" &lt;\/snip&gt;\r\nFile \"\/usr\/lib64\/python2.7\/site-packages\/IPython\/frontend\/html\/notebook\/__init__.py\", line 8, in &lt;module&gt;\r\n raise ImportError(msg)ImportError: The IPython Notebook requires tornado &gt;= 2.1.0<\/pre>\n<p>But, a quick\u00a0<em>emerge -av www-servers\/tornado\u00a0<\/em>and <em>ipython notebook<\/em>\u00a0I was off and running:<\/p>\n<p><a href=\"http:\/\/drsfenner.org\/blog\/?attachment_id=60\" rel=\"attachment wp-att-60\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-60\" alt=\"ipython-start\" src=\"http:\/\/drsfenner.org\/blog\/wp-content\/uploads\/2013\/09\/ipython-start-300x185.jpeg\" width=\"300\" height=\"185\" srcset=\"https:\/\/drsfenner.org\/blog\/wp-content\/uploads\/2013\/09\/ipython-start-300x185.jpeg 300w, https:\/\/drsfenner.org\/blog\/wp-content\/uploads\/2013\/09\/ipython-start-1024x633.jpeg 1024w, https:\/\/drsfenner.org\/blog\/wp-content\/uploads\/2013\/09\/ipython-start-624x386.jpeg 624w, https:\/\/drsfenner.org\/blog\/wp-content\/uploads\/2013\/09\/ipython-start.jpeg 1070w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>A simple click on the New Notebook button:<\/p>\n<p><a href=\"http:\/\/drsfenner.org\/blog\/?attachment_id=61\" rel=\"attachment wp-att-61\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-61\" alt=\"new-notebook-button\" src=\"http:\/\/drsfenner.org\/blog\/wp-content\/uploads\/2013\/09\/new-notebook-button.jpeg\" width=\"100\" height=\"28\" \/><\/a><\/p>\n<p>and I had an (i)python prompt. \u00a0Part of my goal with this is to experiment with formatting of hybrid text, mathematics, and (mostly python) source code for a book. \u00a0I have an idea in mind, but much like artistry, I have to figure out (clarify and implement) what I have in my head. \u00a0Anyway, as a simple example, I&#8217;m going to play with some description, mathematics, and code for the time-honored method of\u00a0<em>linear regression<\/em>. \u00a0And for that, I&#8217;m going to switch over to my notebook. \u00a0Hopefully, I&#8217;ll be able to share it @<a href=\"http:\/\/nbviewer.ipython.org\/\">http:\/\/nbviewer.ipython.org\/<\/a>. \u00a0I&#8217;ll also try the static html export facility to dump it here.<\/p>\n\n<p>So, it turns out I was a bit ahead of myself. \u00a0Emerging <em>tornado<\/em> installed a half-baked, and somewhat broken, MathJax processing. \u00a0This resulted in some weird &#8220;this works, that doesn&#8217;t&#8221; \\(LaTeX\\) support. \u00a0I uninstalled <em>iPython<\/em> and <em>www-servers\/tornado\u00a0<\/em>and I made some edits to <em>\/etc\/portage\/package.use:<\/em><\/p>\n<pre>mfenner [528] % grep dev-python\/ipython \/etc\/portage\/package.use\r\ndev-python\/ipython -wxwidgets matplotlib examples notebook<\/pre>\n<p>The change resulted in a much happier installation.<\/p>\n<p>I dug up (&#8220;Googled&#8221;) a few resources for editing the notebooks, but the underlying URLs are are a bit ugly (they might break):\u00a0<a href=\"http:\/\/nbviewer.ipython.org\/url\/github.com\/ipython\/ipython\/raw\/master\/examples\/notebooks\/Part%205%20-20Rich%20Display%20System.ipynb \">Rich Display System<\/a>\u00a0and \u00a0<a href=\"http:\/\/nbviewer.ipython.org\/url\/github.com\/ipython\/ipython\/raw\/master\/examples\/notebooks\/Part%204%20-%20Markdown%20Cells.ipynb\">Markdown Cells<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Oddly, although I&#8217;ve been using the scientific Python stack for about 10 years, I&#8217;ve never jumped on the iPython band-waggon. \u00a0Well, I&#8217;ve fired it up once or twice, but I&#8217;ve never really dug into using it. \u00a0I&#8217;ve gotten more curious about the iPython notebook facility (I assume this idea traces back to Mathematica&#8217;s notebook nomenclature). [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,7],"tags":[],"class_list":["post-59","post","type-post","status-publish","format-standard","hentry","category-mrdr","category-sci-math-stat-python"],"_links":{"self":[{"href":"https:\/\/drsfenner.org\/blog\/wp-json\/wp\/v2\/posts\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/drsfenner.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/drsfenner.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/drsfenner.org\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/drsfenner.org\/blog\/wp-json\/wp\/v2\/comments?post=59"}],"version-history":[{"count":15,"href":"https:\/\/drsfenner.org\/blog\/wp-json\/wp\/v2\/posts\/59\/revisions"}],"predecessor-version":[{"id":77,"href":"https:\/\/drsfenner.org\/blog\/wp-json\/wp\/v2\/posts\/59\/revisions\/77"}],"wp:attachment":[{"href":"https:\/\/drsfenner.org\/blog\/wp-json\/wp\/v2\/media?parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/drsfenner.org\/blog\/wp-json\/wp\/v2\/categories?post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/drsfenner.org\/blog\/wp-json\/wp\/v2\/tags?post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}