Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install matplotlib: "no pkg-config"

When I run pip install matplotlib (within a virtualenv), the first lines of output are:

Downloading/unpacking matplotlib
  Running setup.py egg_info for package matplotlib
    basedirlist is: ['/usr/local/', '/usr', '/usr/X11', '/opt/local']
    ============================================================================
    BUILDING MATPLOTLIB
                matplotlib: 1.2.0
                    python: 2.7.3 (default, Dec 14 2012, 13:31:05)  [GCC 4.2.1
                            (Apple Inc. build 5666) (dot 3)]
                  platform: darwin

    REQUIRED DEPENDENCIES
                     numpy: 1.6.2
                 freetype2: found, but unknown version (no pkg-config)

    OPTIONAL BACKEND DEPENDENCIES
                    libpng: found, but unknown version (no pkg-config)
                   Tkinter: Tkinter: 81008, Tk: 8.5, Tcl: 8.5
                      Gtk+: no
                            * Building for Gtk+ requires pygtk; you must be able
                            * to "import gtk" in your build/install environment
           Mac OS X native: yes
                        Qt: no
                       Qt4: no
                    PySide: no
                     Cairo: no
<snip>

Note

  1. the "no pkg-config", and
  2. the missing Qt library.

First, contrary to what the output above says, pkg-config is in fact installed and on the PATH:

% pkg-config --version
0.27.1
% which pkg-config
/usr/local/bin/pkg-config

Second, qt is available in the same directory where freetype and libpng were found:

% ls -l /usr/local/opt/{freetype,libpng,qt} | cut -c43-
/usr/local/opt/freetype -> ../Cellar/freetype/2.4.10/
/usr/local/opt/libpng -> ../Cellar/libpng/1.5.13/
/usr/local/opt/qt -> ../Cellar/qt/4.8.4/

My question has three parts:

  1. Where does pip install matplotlib get that basedirlist (3rd line of the output above)?
  2. What must I do differently so that pip install matplotlib will find pkg-config?
  3. What must I do differently so that pip install matplotlib will find qt?
like image 307
kjo Avatar asked Dec 20 '12 20:12

kjo


2 Answers

On Mac OS: I use which pkg-config to check installation. If not, use brew to install and it works:

brew install pkg-config
like image 172
zhaoqing Avatar answered Sep 19 '22 17:09

zhaoqing


sudo apt-get build-dep python-matplotlib
like image 29
Grzegorz Pawełczuk Avatar answered Sep 20 '22 17:09

Grzegorz Pawełczuk