Installing Scientific Python on Mac OS X using Homebrew and Pip

I encountered some difficulty while installing the SciPy stack on my Mac. I tried using Anaconda and Enthought Canopy as these contained all the essential packages in one installer. They both failed to install scipy though, possibly due to the issue with the Apple LLVM compiler that comes with the XCode 5.1.1 update. After some google-searching, I found this wonderful blog post that uses Homebrew and Pip and it almost worked for me. Here's how I fixed some of the additional issues, not detailed in that post.

1. "clang: error: unknown argument" while installing the matplotlib and pandas packages using pip

Solution: Prefix the 'pip install <package>' command with 'sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install <package>'

2. "Import-Error: No module named scipy" when importing the scipy module

Solution: When Homebrew is used to install scipy, the entire library is copied to '/usr/local/Cellar/scipy/<scipy-version>/lib/python<python-version>/site-packages'. You just need to add that directory to your PYTHONPATH and save it in your .profile, .bashrc or .bash_profile file.

To test the installation, I tried importing the numpy, scipy, pandas and matplotlib modules and saw no errors. I also ran the numpy and scipy unit tests. Numpy tests ran without any errors but I saw some errors with scipy. I'm not sure if this will cause me any headaches later on but for now, I'm ready to go!