[Numpy-discussion] numpy docs dependency problem in Ubuntu
Fri Feb 11 11:49:29 CST 2011
>> We can't put python-matplotlib in main because of *its* dependencies.
> As a digression, I think the python-matplotlib dependencies could be
> significantly reduced. For a number of use cases (this is one of them,
> but there are others), you don't need any GUI backend. Independent of
> this issue, it would be great to be able to install python-matplotlib
> in a headless server environment without pulling in all of those GUI
> bits. Looking at the list of the hard dependencies, I don't understand
> why half of them are there.
This web page lists several "dependencies" that are optional. Just
flipping through the list, I can see several packages that I know that I
do not have, and several more that I have never heard of. "Never heard
of" could mean that it is in my linux distro and I don't know it, but I
am certain that I have machines that do not have cairo or gtk+ or qt.
A matplotlib application selects one of the available backends to draw
the graphics. If I remember correctly _all_ backends are optional in
matplotlib, but there is at least one ("agg") that is available everywhere.
When you install matplotlib, it builds support for any backends that it
can. A backend that depends on a missing library does not get a C
extension built. BUT the python code is still installed. The only way
to know that a backend is not supported in this installation is to try
to use it.
>>> import matplotlib.backends.backend_qt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/stsci/pyssgdev/2.7/matplotlib/backends/backend_qt.py", line
19, in <module>
raise ImportError("Qt backend requires pyqt to be installed.")
ImportError: Qt backend requires pyqt to be installed.
Ok - I don't have qt on this machine.
So, you can try this: Get a build machine that has all the packages
required by the various backends. Build a binary distribution of
matplotlib. Install it on a machine that has only some of the libraries
required by the backends.
The result is a copy of matplotlib with _some_ working backends and some
that fail because of missing libraries. As you install other supporting
packages, additional backends can start working because their shared
library is now present.
So, if I install matplotlib and pyqt is not there I get a working
matplotlib without QT support. If I use a package installer to install
pyqt, presumably it will also install the QT libraries, resulting in
matplotlib that does have qt support.
I'm not saying you want to do this, but it is an option. If you want to
experiment in this direction, there is a list that breaks out
requirements for the core and requirements for each of the backends at
More information about the NumPy-Discussion