{"id":2501,"date":"2012-08-30T02:30:04","date_gmt":"2012-08-30T06:30:04","guid":{"rendered":"http:\/\/labrigger.com\/blog\/?p=2501"},"modified":"2012-09-01T14:36:55","modified_gmt":"2012-09-01T18:36:55","slug":"getting-neuron-to-run-on-os-x-with-python-support","status":"publish","type":"post","link":"http:\/\/labrigger.com\/blog\/2012\/08\/30\/getting-neuron-to-run-on-os-x-with-python-support\/","title":{"rendered":"Getting NEURON to run on OS X with Python support"},"content":{"rendered":"<p><strong>UPDATED!<\/strong><br \/>\nThis question has come up a number of times recently: how does one get <a href=\"http:\/\/www.neuron.yale.edu\/neuron\/\">NEURON<\/a> to run with <a href=\"http:\/\/www.python.org\">Python<\/a> support on OS X.<\/p>\n<p>At this time, there&#8217;s no simple way to install NEURON with Python support any more because Eilif&#8217;s package is outdated and won&#8217;t run with current EPD and XCode versions. The only way to<br \/>\nget a current version to run is to install from source.<\/p>\n<p><strong>1. Install MacPorts as described here:<br \/>\n<\/strong>http:\/\/www.macports.org\/install.php<\/p>\n<p><strong>2. Open up a terminal (Applications->Utilities->Terminal).<br \/>\n<\/strong><br \/>\n<strong>3. Get some useful MacPorts packages:<br \/>\n<\/strong><\/p>\n<pre><font size=-1>   $ sudo port install python27 py27-numpy py27-scipy py27-matplotlib py27-ipython\n<\/font><\/pre>\n<p>   Make sure that installation completes without errors. Then, select MacPorts&#8217; Python as your default version:<\/p>\n<pre><font size=-1>   $ sudo port select python python27<\/font><\/pre>\n<p><strong>4. Download the NEURON source:<br \/>\n<\/strong><\/p>\n<pre><font size=-1>   $ cd ~\n   $ mkdir neuron\n   $ cd ~\/neuron\n   $ curl -O http:\/\/www.neuron.yale.edu\/ftp\/neuron\/versions\/v7.2\/iv-17.tar.gz\n   $ curl -O http:\/\/www.neuron.yale.edu\/ftp\/neuron\/versions\/v7.2\/nrn-7.2.tar.gz\n<\/font><\/pre>\n<p><strong>5. Unpack the source code and move things into place:<br \/>\n<\/strong><\/p>\n<pre><font size=-1>   $ tar xvzf iv-17.tar.gz\n   $ tar xvzf nrn-7.2.tar.gz\n   $ mv iv-17 iv\n   $ mv nrn-7.2 nrn\n<\/font><\/pre>\n<p><strong>6. Build the InterViews part (it&#8217;s an antique widgets toolkit for the GUI):<br \/>\n<\/strong><\/p>\n<pre><font size=-1>   $ cd ~\/neuron\/iv\n   $ .\/configure --prefix=`pwd`\n   $ make -j4\n   $ make install\n<\/font><\/pre>\n<p>   Note that `pwd` is surrounded by backquote characters.<\/p>\n<p><strong>7. Build NEURON<br \/>\n<\/strong><\/p>\n<pre><font size=-1>   $ cd ~\/neuron\/nrn\n   $ .\/configure --with-iv=${HOME}\/neuron\/iv --with-nrnpython=\/opt\/local\/bin\/python --prefix=`pwd`\n   $ make -j4\n   $ make install\n<\/font><\/pre>\n<p>   Again, note that `pwd` is surrounded by backquote characters.<\/p>\n<p><strong>8. Build NEURON&#8217;s Python module:<br \/>\n<\/strong><\/p>\n<pre><font size=-1>   $ cd ~\/neuron\/nrn\/src\/nrnpython\/\n   $ python setup.py build\n   $ sudo python setup.py install\n<\/font><\/pre>\n<p><strong>9. Add NEURON&#8217;s binary directory to your path:<br \/>\n<\/strong><\/p>\n<pre><font size=-1>   $ cd ~\n   $ echo \"export PATH=${HOME}\/neuron\/nrn\/x86_64\/bin:\\${PATH}\" >> ~\/.profile\n<\/font><\/pre>\n<p><strong>10. Test the Python module:<br \/>\n<\/strong><\/p>\n<pre><font size=-1>   $ ipython --pylab\n<\/font><\/pre>\n<p>    Then, at the ipython command prompt ([1]:), type:<\/p>\n<pre><font size=-1>   from neuron import gui\n<\/font><\/pre>\n<p>    Which should bring up NEURON&#8217;s main menu.<\/p>\n<p>N.B. Do <strong><em>not<\/em><\/strong> use the Enthought Python Distribution (EPD). Use <a href=\"http:\/\/www.macports.org\">MacPorts<\/a> instead.  The NEURON GUI doesn&#8217;t work properly with EPD at this time.<\/p>\n<p><em>Post by Christoph Schmidt-Hieber.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p><strong>UPDATED!<\/strong><br \/>\nThis question has come up a number of times recently: how does one get <a href=\"http:\/\/www.neuron.yale.edu\/neuron\/\">NEURON<\/a> to run with <a href=\"http:\/\/www.python.org\">Python<\/a> support on OS X.<\/p>\n<p>At this time, there&#8217;s no simple way to install NEURON with Python support any more because Eilif&#8217;s package is outdated and won&#8217;t run with current EPD and XCode versions. The&#8230;<\/p>\n<div class=\"read-more\"><a href=\"http:\/\/labrigger.com\/blog\/2012\/08\/30\/getting-neuron-to-run-on-os-x-with-python-support\/\">Read More<\/a><\/div><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-2501","post","type-post","status-publish","format-standard","hentry","category-software"],"_links":{"self":[{"href":"http:\/\/labrigger.com\/blog\/wp-json\/wp\/v2\/posts\/2501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/labrigger.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/labrigger.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/labrigger.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/labrigger.com\/blog\/wp-json\/wp\/v2\/comments?post=2501"}],"version-history":[{"count":7,"href":"http:\/\/labrigger.com\/blog\/wp-json\/wp\/v2\/posts\/2501\/revisions"}],"predecessor-version":[{"id":2531,"href":"http:\/\/labrigger.com\/blog\/wp-json\/wp\/v2\/posts\/2501\/revisions\/2531"}],"wp:attachment":[{"href":"http:\/\/labrigger.com\/blog\/wp-json\/wp\/v2\/media?parent=2501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/labrigger.com\/blog\/wp-json\/wp\/v2\/categories?post=2501"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/labrigger.com\/blog\/wp-json\/wp\/v2\/tags?post=2501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}