Install scipy, numpy and pandas OS X Mountain Lion

Since I last posted a “how-to” blog-post regarding the installation of
numpy, scipy, and pandas, things have gotten a good bit easier, so
this is going to be a shorter post.

I’m working with a fresh install of Mountain Lion OS X, with nothing
else
installed.

  1. step 1: Install homebrew for mac, using the
    ruby script found on its homepage:

     $ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
    
  2. If you follow the homebrew instructions at the end of the install,
    you should then run

     $ brew doctor
    

    and get a complaint about not having X Code installed. At that
    point, go the App Store, download X Code. After you download X Code,
    go to Preferences and download the X Code Command Line Tools
    under Components.

    At this point you should be able to run: \$brew doctor

    and get the encouraging message:

     your system is raring to brew!
    
  3. Now armed with homebrew, and a quick glance at Homebrew & Python
    Page
    you
    can see that Python 2.x is recommended to be installed via:

     $ brew install python
    

    if you’re installing 3.x you can see replace the word python
    with python3 and you’re good to go. Make sure things are done this
    way, that way you automatically get the install of distribute and
    pip (which will be used in the next steps)

  4. At this point, use brew to install any other packages you’d like
    (for instance, git was a no-brainer along with a couple of
    others).

  5. One package that you MUST install with homebrew is gfortran,
    as the scipy library depends on this. Therefore, the next step is:

     $ brew install gfortran
    
  6. After that’s done, you simply need to:

     $pip install numpy
     $pip install scipy
     $pip install pandas
     $brew install freetype #see my last post if you want to know why
     $pip install matplotlib
    
  7. If you wish to test your installations, you need only

     $pip install nose  #needed for all tests
    
     #inside of IDLE or iPython
     [In:] import numpy
     [In:] numpy.test('full')
     [In:] import scipy
     [In:] scipy.test()
    
     #from command prompt
     $ nostetests pandas
    

And there you have it… happy key tappin’!

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.