Reputation: 35311
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
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:
- Where does
pip install matplotlib
get thatbasedirlist
(3rd line of the output above)?- What must I do differently so that
pip install matplotlib
will findpkg-config
?- What must I do differently so that
pip install matplotlib
will findqt
?
Upvotes: 15
Views: 44876
Reputation: 795
On Mac OS: I use which pkg-config
to check installation. If not, use brew to install and it works:
brew install pkg-config
Upvotes: 15
Reputation: 173
Old question, but wanted to leave some possibly helpful crumbs.
I just dealt with a somewhat similar issue on Ubuntu 12.04 after trying to manually install an application that relied on a set of Python bindings that were manually installed within a virtualenv. The Python bindings were clearly installed in an appropriate place within my virtualenv, but the installer simply couldn't find them with pkg-config
.
So to answer the original questions:
pkg-config
just fine; it's just not detecting any useful information for freetype2
and libpng
.python-qt4
globally and creating a virtualenv with --system-site-packages
enabled should make matplotlib happy, even if it means littering your global environment with modules. But I haven't been able to get pip to do anything useful when trying to install PyQt4 or python-qt in a virtualenv.libqt4-dev
should also alleviate any dependency issues when building anything relying on Qt4.man pkg-config
On most systems, pkg-config looks in /usr/lib/pkgconfig, /usr/share/pkgconfig, /usr/local/lib/pkgconfig and /usr/local/share/pkgconfig for these files. It will additionally look in the colon-separated (on Windows, semicolon-separated) list of directories specified by the PKG_CONFIG_PATH environment variable.
pkg-config
is looking for *.pc files; the fact that you found those dependencies installed somewhere doesn't mean pkg-config
will find any *.pc files in those directories.PKG_CONFIG_PATH
appropriately.bin/activate
script in my virtualenv.
_OLD_VIRTUAL_PATH
before updating PATH
upon activation, and reverting back to _OLD_VIRTUAL_PATH
upon deactivationPKG_CONFIG_PATH
was blank to begin with, you need a bit more logic to make sure it gets cleared upon deactivationUpvotes: 1
Reputation: 457
Just install freetype fonts to get matplotlib.
sudo apt-get install freetype*
All the matplotlib files are installed to /usr/local/lib/python2.7/site-packages/. Even if you want to install using pip installer, you need to fix freetype font problem, which can be done as stated above.
Upvotes: 8
Reputation: 485
I had an almost identical error. I looked through the errors further down, and it seems like the problem was with freetype2.
I've had similarly frustrating issues with other packages that use freetype. For me, the compile error came from the following:
/usr/local/include/freetype2/freetype/*.h are the freetype files.
/usr/local/include is the search directory.
-Ifreetype/*.h is the flag passed to the compiler.
The problem is subtle, but I was able to get matplotlib to compile (which honestly, is approximately all I really care about) by copying /usr/local/include/freetype2/freetype -> /usr/local/include/freetype.
Hopefully this will help anyone who stumbles across this!
Upvotes: 0
Reputation: 375
I can't ask your specific questions, but my pip install matplotlib looked a lot like yours the other day. After five hours of slamming my head against the wall, this solution worked for me (from practicalcomputing.org
I got this set of commands to set up simlinks:
sudo mkdir -p /usr/local/include
sudo ln -s /usr/X11/include/freetype2/freetype /usr/local/include/freetype
sudo ln -s /usr/X11/include/ft2build.h /usr/local/include/ft2build.h
sudo ln -s /usr/X11/include/png.h /usr/local/include/png.h
sudo ln -s /usr/X11/include/pngconf.h /usr/local/include/pngconf.h
sudo ln -s /usr/X11/include/pnglibconf.h /usr/local/include/pnglibconf.h
sudo mkdir -p /usr/local/lib
sudo ln -s /usr/X11/lib/libfreetype.dylib /usr/local/lib/libfreetype.dylib
sudo ln -s /usr/X11/lib/libpng.dylib /usr/local/lib/libpng.dylib
It doesn't quite solve all your issues, but it solved my pkg-config issue (among others). Perhaps a similar link would help with QT.
Upvotes: 2