{"id":64,"date":"2011-11-27T15:31:00","date_gmt":"2011-11-27T15:31:00","guid":{"rendered":"https:\/\/sandrock.co.za\/carl\/2011\/11\/27\/scientific-python-setup-for-mac-os-x-10-6\/"},"modified":"2011-11-27T15:31:00","modified_gmt":"2011-11-27T15:31:00","slug":"scientific-python-setup-for-mac-os-x-10-6","status":"publish","type":"post","link":"https:\/\/sandrock.co.za\/carl\/2011\/11\/scientific-python-setup-for-mac-os-x-10-6\/","title":{"rendered":"Scientific python setup for Mac OS X 10.6"},"content":{"rendered":"<p>For posterity, and to save some people some trouble with their install, here is what I have done to get up to a working matplotlib on my Mac running Mac OS X Snow Leopard 10.6.8:<\/p>\n<div>\n<ul>\n<li>Download and install the <a href=\"http:\/\/www.python.org\/\">python.org<\/a> python 2.7 from the <a href=\"http:\/\/www.python.org\/ftp\/python\/2.7.2\/python-2.7.2-macosx10.6.dmg\">.dmg installer<\/a><\/li>\n<li>Download <a href=\"http:\/\/pypi.python.org\/packages\/2.7\/s\/setuptools\/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea\">this egg<\/a>. To run it, you may have to rename it to have a .egg extention rather than a .egg.sh one.<\/li>\n<li>Open a terminal<\/li>\n<li>Execute the file you renamed before by typing &#8220;sudo bash path\/to\/filename&#8221; &#8211; to get the path to filename, you can open a Finder window showing the file, then drag the icon onto the terminal &#8211; that will insert the full path.<\/li>\n<li>Install <a href=\"http:\/\/pypi.python.org\/pypi\/pip\">pip<\/a> by typing &#8220;sudo easy_install pip&#8221;<\/li>\n<li>Install GNU readline by typing &#8220;sudo pip install readline&#8221;<\/li>\n<li>Install <a href=\"http:\/\/code.google.com\/p\/python-nose\/\">nose<\/a> (used for testing) by typing &#8220;sudo pip install nose&#8221;<\/li>\n<li>Install <a href=\"http:\/\/ipython.org\/\">iPython<\/a> by typing &#8220;sudo pip install ipython&#8221;<\/li>\n<li>Download and install the <a href=\"http:\/\/garr.dl.sourceforge.net\/project\/numpy\/NumPy\/1.6.1\/numpy-1.6.1-py2.7-python.org-macosx10.6.dmg\">NumPy binary distribution<\/a><\/li>\n<li>Download and install the <a href=\"http:\/\/garr.dl.sourceforge.net\/project\/scipy\/scipy\/0.10.0\/scipy-0.10.0-py2.7-python.org-macosx10.6.dmg\">SciPy binary distribution<\/a><\/li>\n<li>Download and install the <a href=\"http:\/\/downloads.activestate.com\/ActiveTcl\/releases\/8.5.11.0\/ActiveTcl8.5.11.0.295402-macosx10.5-i386-x86_64-threaded.dmg\">Activestate tcl\/tk<\/a>  &#8211; this is the one <a href=\"http:\/\/www.python.org\/getit\/mac\/tcltk\/\">recommended on python.org<\/a>.  If you click through the python website to the Activestate one note that you don&#8217;t have to fill in your info to download the files.<\/li>\n<\/ul>\n<div>You should now have a working scientific environment that allows you to do most of the things you would be able to in a stock install of Matlab with a couple of packages thrown in, except for plotting.  The next step is a bit more arduous, because the default binary install of <a href=\"http:\/\/matplotlib.sourceforge.net\/\">Matplotlib<\/a> does not work (at least not for me).  This is what I had to do to get it working:<\/div>\n<\/div>\n<div><\/div>\n<div>\n<ul>\n<li>Download and install XCode<\/li>\n<li>Install <a href=\"http:\/\/git-scm.com\/download\">git<\/a><\/li>\n<li>Open up a terminal<\/li>\n<li>Type &#8220;git clone git:\/\/github.com\/matplotlib\/matplotlib.git&#8221;<\/li>\n<li>Type &#8220;cd matplotlib&#8221;<\/li>\n<li>Type &#8220;sudo su&#8221; and provide your password when prompted<\/li>\n<li>Create a temporary directory (XXX in the following command) then do &#8216;ARCHFLAGS=&#8221;-arch x86_64&#8243; LDFLAGS=&#8221;-arch x86_64&#8243; CFLAGS=&#8221;-arch x86_64&#8243; FFLAGS=&#8221;-m64&#8243; PREFIX=XXX make -f make.osx fetch deps mpl_build mpl_install&#8217;<\/li>\n<li>Type &#8220;cp -r XXX\/lib\/site-packages\/* \/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/&#8221;<\/li>\n<\/ul>\n<div>To test if all this worked, do the following:<\/div>\n<\/div>\n<div>\n<ul>\n<li>Test ipython: &#8220;iptest&#8217;<\/li>\n<li>Start ipython and do<\/li>\n<li>Test numpy: &#8220;import numpy; numpy.test()&#8221;<\/li>\n<li>Test scipy: &#8220;import scipy; scipy.test()&#8221;<\/li>\n<li>Test matplotlib: &#8220;import matplotlib; matplotlib.test()&#8221;<\/li>\n<\/ul>\n<div>Don&#8217;t be too upset if some errors occur: it seems the test suites aren&#8217;t entirely up to date.  As long as you don&#8217;t see a segfault or ipython crash, it should be ok.<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>For posterity, and to save some people some trouble with their install, here is what I have done to get up to a working matplotlib on my Mac running Mac OS X Snow Leopard 10.6.8: Download and install the python.org python 2.7 from the .dmg installer Download this egg. To run it, you may have [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[4],"tags":[118],"class_list":["post-64","post","type-post","status-publish","format-standard","hentry","category-python","tag-build"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/posts\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/comments?post=64"}],"version-history":[{"count":0,"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/posts\/64\/revisions"}],"wp:attachment":[{"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/media?parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/categories?post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sandrock.co.za\/carl\/wp-json\/wp\/v2\/tags?post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}