Fork me on GitHub

Getting IPython Notebook Working on Mac OS X

I've been getting into ipython notebook recently, especially since seeing some demos at PyCon 2014. I maintain a toolchain at work for processing monthly stats of our product's use in the field, using python but graphing in GNUPlot, Given the capabilities of matplotlib and pandas, this little project is ideal for a pure python replacement.

I don't need ipython notebook to make this solution work, but it's an excuse to play with it and I never miss an opportunity like that. But, I do have a Mac on my desktop at home right now. The official way to install ipython notebook and SciPy is to use Anaconda, but I prefer to not run foreign installers as root on my system when I can avoid it, so virtualenv is preferred. I could work on my Linux laptop, but I have dual screens on my desktop, and it's possible that my next laptop will have a piece of fruit on it too, you never know.

Luckily I did find an excellent blog post on the topic, but as often happens online, the information is a bit dated. I tried building the components and got major complaints (ie. compile errors) from clang. Thankfully I got a hand from our own OPAG mailing list. Clang can be told to be less strict by setting the ARCHFLAGS environment variable like so:

export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future

Do this before installing via pip, as pretty much every package will otherwise fail due to these errors. Hopefully our C programmers will fix these issues, as in future versions of clang, you likely won't be able to downgrade these errors to warnings.

Also, once installing freetype via brew, you do have to include it in the compiler's include path so it can find the freetype headers:

sudo ln -s /usr/local/include/freetype2/ /usr/include/freetype

While this allowed me to build everything, unfortunately building the graphs still didn't work, and I saw this error in the terminal:

libpng warning: Application built with libpng-1.5.11 but running with

I had to dig for a while, but I finally found that XQuartz was linking to libpng 1.5, and I couldn't change that. Homebrew is currently pushing libpng 1.6, so I had to manually roll the version back via Git:

brew versions libpng
cd $( brew --prefix )
git checkout <sha> <path>
brew install libpng

Once I did that and rebuilt everything depending on it (see brew deps), everything started working.

Hmm. What are the chances that I'll be able to convince the XQuartz people and the Homebrew people to coordinate on libpng? Yeah. Seems unlikely.

Comments !