building matplotlib 1.3 on OS X 10.8.4

I built MPL 1.3 from source, all seem to go OK but I ran into the problem of not finding libfreetype.6.dylib when importing.

On the web, I found references to this problem for builds on OS X. The solutions refer to a file README.osx, which is not

present in the 1.3 distribution. The documentation (http://matplotlib.org/1.3.0/users/installing.html) also refers to this file and appears to be out of date.

I have tried fiddling with the LD_LIBRARY paths, but have not come upon a solution.

–Jim Boyle

You might try installing the latest XQuartz to see if that helps - XQuartz

I think you can use homebrew <http://brew.sh> or macports <http://www.macports.org> to install a copy of libfreetype, but it's fairly easy to do manually. Here's what I've done on recent versions of OS X. I'm not sure it's necessary to install everything below. Note that this only builds the native architecture for the version of OS X you are using, for example 64 bit for OS X 10.8, so there may be problems if you have to build matplotlib for a different architecture. In that case, you can add the appropriate CFLAGS="-arch blah" parameter to ./configure

download, unpack, configure and install pkgconfig
  curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz
  tar -xf pkg-config-0.28.tar.gz
  cd pkg-config-0.28
  ./configure --with-internal-glib
  make -j4
  sudo make install

download, unpack, configure and install freetype
  curl -O http://hivelocity.dl.sourceforge.net/project/freetype/freetype2/2.5.0/freetype-2.5.0.1.tar.bz2
  tar -xf freetype-2.5.0.1.tar.bz2
  cd freetype-2.5.0.1
  ./configure
  make -j4
  sudo make install

download, unpack, configure and install fontconfig
  curl -O http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.10.93.tar.bz2
  tar -xf fontconfig-2.10.93.tar.bz2
  cd fontconfig-2.10.93
  ./configure
  make -j4
  sudo make install

download, unpack, configure and install libpng
  curl -O http://hivelocity.dl.sourceforge.net/project/libpng/libpng15/1.5.17/libpng-1.5.17.tar.bz2
  tar -xf libpng-1.5.17.tar.bz2
  cd libpng-1.5.17
  make -j4
  sudo make install

download, unpack, configure and install ghostscript
  curl -O http://downloads.ghostscript.com/public/ghostscript-9.09.tar.gz
  tar -xf ghostscript-9.09.tar.gz
  cd ghostscript-9.09
  ./configure --with-x \
  --x-includes=/opt/X11/include \
  --x-libraries=/opt/X11/lib \
  --disable-gtk \
  --with-system-libtiff \
  CFLAGS="-arch x86_64 -arch i386" LDFLAGS="-arch x86_64 -arch i386"
  make -j4
  sudo make install

Now python3 setup.py in the matplotlib directory should show that it found the libs you just installed.

I hope this works for you,
Scott

···

On Aug 22, 2013, at 10:28 PM, James Boyle <jsboyle314@...287...> wrote:

I built MPL 1.3 from source, all seem to go OK but I ran into the problem of not finding libfreetype.6.dylib when importing.

On the web, I found references to this problem for builds on OS X. The solutions refer to a file README.osx, which is not
present in the 1.3 distribution. The documentation (Installing — Matplotlib 1.3.0 documentation) also refers to this file and appears to be out of date.

I have tried fiddling with the LD_LIBRARY paths, but have not come upon a solution.

--Jim Boyle