Wow ! Much Homebrew. Very Numpy. So Scipy. Such OpenCV

The first time I tried to install NumPy+SciPy in my Mac, it turned into a Kafkaesque nightmare, out of which I only managed to surface due to luck and grit. (Only to have, a few weeks later, a system update breaking my MacPorts and sending everything back to hell.)

The second time around, I traded freedom for comfort, and went with Enthought Python Distribution (now Enthought Canopy).  EPD came with an impressive list of available packages, and, more importantly : it just worked. It was also generously available at no fee for academic use, an offer from which I’ve profited.

Recently though, I became a latecomer to Homebrew, enticed by their taglines (‘The missing package manager of OS X’, ‘MacPorts driving you to drink ? Try Homebrew !’) and by their oneliner installation procedure (look for ‘Install Homebrew’ at their homepage).

So far, I am incredibly impressed — I’ve done fresh installations of Python, Nose, NumPy, OpenCV, GCC (!), SciPy, Bottleneck, wxPython and PIL. All went smoothly, installing and testing without smoke. My command-line history reveals just how easy it was :

ruby -e "$(curl -fsSL"

brew install python

/usr/local/bin/pip-2.7 install nose

/usr/local/bin/pip-2.7 install numpy

brew install opencv

brew install gcc49

brew install scipy

/usr/local/bin/pip-2.7 install bottleneck

brew install wxwidgets

/usr/local/bin/pip install pil

The only pitfall (if it may even be called so) is that some Python packages prefer the homebrew installer, and some prefer pip — but quick error and trial works just fine to find out.

Often homebrew installer will discreetly guide you through the process, like when I asked ‘brew install wxpython’, and it told me that there was no such package, but that  ‘wxwidgets’ already came with the wxPython bindings. That kind of gentle bending of Unix philosophy, on behalf of preserving the user sanity, never fails to win my respect.

Now : maybe homebrew is running so smoothly only because I have EPD already installed in this machine, all exoteric dependences having been previously solved. I also had Xcode fully installed and operational, a requirement for most interesting tools working on OS X at all. Remark also that I am still running Mountain Lion.

Homebrew’s express requirements seem to be quite modest, however : the Command-line Tools for Xcode, and a bash or zsh-compatible shell (the default terminal is fine). Additionally, it resides in a branch independent from EPD, so it probably can’t cound on the latter’s dependences. In a few weeks, I intend to do a fresh installation of Mavericks on this machine, and we will know for sure.

7 thoughts on “Wow ! Much Homebrew. Very Numpy. So Scipy. Such OpenCV

  1. All the nightmares with MacPorts could turn worst after your Mavericks upgrade! And I had some…

    One of the most interesting tool that comes tied to brew is the $brew doctor. It will help you to fix all lib dependencies (python will probably show up on the report), PATH variables not set correctly and other interesting stuff for a smooth use of your environment.

    Homebrew is a “here to stay” tool and really attends to their quote: ‘The missing package manager of OS X’. Some of the greatest development players are now migrating their “recipes” to brew, soon we will be able to cook them all.

    Best regards and keep trying the good brewery recipes!

    • Hi Claudio — thank you. I had given up development on the Mac already and was using a Linux server for everything (OS X on the client, Linux on the server is one of my mantras). But Homebrew gave me hope that using the OS X for development might be feasible after all…

  2. I found Continuum Anaconda Python distribution ( ) a breeze. It install all the Scipy, Numpy, Scikit Learn and a lot of other scientific packages with no problems. With a educational email address you can also get the Accelerate package for free and it installs a MKL (Intel’s linear algebra library) enabled version of Numpy and Scipy. I have been doing some reasonably heavy duty computations on my laptop since.

  3. If you set up the $PATH probably, you won’t need to include the path “/usr/local/bin/pip-2.7” every time you install a new package. You can read about it here – or simple open a new Terminal window, and type “open .bash_profile”, if the file not found, do “touch .bash_profile” first and try it again, then add in this line “export PATH=/usr/local/bin:$PATH” and save, simply open up another new Terminal window, and type “which python”, it should print “/usr/local/bin/python”. After that you just do “pip install nose munpy scipy” and so on – read for more. NOTE, the double quotes ” is not included for any command. For the best do a “brew update” first to make sure. Hope you find this helps.

    • Correctly setting the $PATH is indeed a good idea. I have put the full path in the commands to ensure that the correct PIP is executed (you can have several parallel Python installations in OS X — which one is executed is a matter of $PATH, among other settings).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s