Issue 1:
When I tried to install matplotlib I got following error (I used newest version in pip):

Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-imsaf6c5/matplotlib/setup.py", line 155, in <module>
result = package.check()
File "/tmp/pip-build-imsaf6c5/matplotlib/setupext.py", line 961, in check
min_version='2.3', version=version)
File "/tmp/pip-build-imsaf6c5/matplotlib/setupext.py", line 445, in _check_for_pkg_config
if (not is_min_version(version, min_version)):
File "/tmp/pip-build-imsaf6c5/matplotlib/setupext.py", line 173, in is_min_version
return found_version >= expected_version
File "/home/jb/.pythonz/pythons/CPython-3.4.3/lib/python3.4/distutils/version.py", line 76, in __ge__
c = self._cmp(other)
File "/home/jb/.pythonz/pythons/CPython-3.4.3/lib/python3.4/distutils/version.py", line 343, in _cmp
if self.version < other.version:
TypeError: unorderable types: str() < int()

Problem was caused by freetype-config --ftversion command returning unexpected output, that is:

freetype-config --ftversion
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
(...)
warning: GREP_OPTIONS is deprecated; please use an alias or script
2.5.2

Warnings were coming from grep that was whining about GREP_OPTIONS set in my enviorment. When I unexported this variable installation procedeed without error.

Issue 2:
As part of Hashdist:

[matplotlib] Building matplotlib/l6hpd5xi44vw, follow log with:
[matplotlib] tail -f /local/certik/tmp/matplotlib-l6hpd5xi44vw-1/build.log
[matplotlib] running [u'/bin/bash', '_hashdist/build.sh']
[matplotlib] environment:
[matplotlib] {'ARTIFACT': u'/local/certik/bld/matplotlib/l6hpd5xi44vw',
[matplotlib] 'BASH': u'/bin/bash',
[matplotlib] 'BUILD': u'/local/certik/tmp/matplotlib-l6hpd5xi44vw-1',
[matplotlib] u'BZIP2_DIR': u'/local/certik/bld/bzip2/yhn7t7sdxdfd',
[matplotlib] u'BZIP2_ID': u'bzip2/yhn7t7sdxdfdkhyie6hg36hqvgccj7rj',
[matplotlib] u'FREETYPE_DIR': u'/local/certik/bld/freetype/3j5vs5xri633',
[matplotlib] u'FREETYPE_ID': u'freetype/3j5vs5xri6335xcnnxh7kt3iudaos7lp',
[matplotlib] 'HASHDIST_CPU_COUNT': '1',
[matplotlib] 'HDIST_CONFIG': '{"gc_roots":"/local/certik/gcroots","build_stores":[{"dir":"/local/certik/bld"}],"source_caches":[{"dir":"/local/certik/src"}],"cache":"/local/certik/cache","build_temp":"/local/certik/tmp"}',
[matplotlib] 'HDIST_IMPORT': u'bzip2/yhn7t7sdxdfdkhyie6hg36hqvgccj7rj freetype/3j5vs5xri6335xcnnxh7kt3iudaos7lp numpy/o7mh7o3cbu5sk2wukmtmo7qeebkdb6sz patchelf/k3rloj265ogtl4dmmmbmyt34dnffryka pkg-config/nnzbjosob2benze3u2c4vhd2swgkevnq png/q24b4y6ojqdwk2nwnblutd4qrjhmlmev python/m327azitptlvocjp2othxwmlsqcmxu3i setuptools/cl5h5p575pm7wzsnkqxnxgbiql45rrkl zlib/3el5ccejre7bcjqgld5gp6iym4ccd5oe',
[matplotlib] 'HDIST_IMPORT_PATHS': u'/local/certik/bld/bzip2/yhn7t7sdxdfd:/local/certik/bld/freetype/3j5vs5xri633:/local/certik/bld/numpy/o7mh7o3cbu5s:/local/certik/bld/patchelf/k3rloj265ogt:/local/certik/bld/pkg-config/nnzbjosob2be:/local/certik/bld/png/q24b4y6ojqdw:/local/certik/bld/python/m327azitptlv:/local/certik/bld/setuptools/cl5h5p575pm7:/local/certik/bld/zlib/3el5ccejre7b',
[matplotlib] 'HDIST_VIRTUALS': '',
[matplotlib] u'NUMPY_DIR': u'/local/certik/bld/numpy/o7mh7o3cbu5s',
[matplotlib] u'NUMPY_ID': u'numpy/o7mh7o3cbu5sk2wukmtmo7qeebkdb6sz',
[matplotlib] 'PATCHELF': u'/local/certik/bld/patchelf/k3rloj265ogt/bin/patchelf',
[matplotlib] u'PATCHELF_DIR': u'/local/certik/bld/patchelf/k3rloj265ogt',
[matplotlib] u'PATCHELF_ID': u'patchelf/k3rloj265ogtl4dmmmbmyt34dnffryka',
[matplotlib] 'PATH': u'/local/certik/bld/python/m327azitptlv/bin:/local/certik/bld/pkg-config/nnzbjosob2be/bin:/local/certik/bld/freetype/3j5vs5xri633/bin:/usr/bin:/bin',
[matplotlib] u'PKG_CONFIG_DIR': u'/local/certik/bld/pkg-config/nnzbjosob2be',
[matplotlib] 'PKG_CONFIG_EXECUTABLE': u'/local/certik/bld/pkg-config/nnzbjosob2be/bin/pkg-config',
[matplotlib] u'PKG_CONFIG_ID': u'pkg-config/nnzbjosob2benze3u2c4vhd2swgkevnq',
[matplotlib] 'PKG_CONFIG_PATH': u'/local/certik/bld/python/m327azitptlv/lib/pkgconfig:/local/certik/bld/png/q24b4y6ojqdw/lib/pkgconfig:/local/certik/bld/freetype/3j5vs5xri633/lib/pkgconfig',
[matplotlib] u'PNG_DIR': u'/local/certik/bld/png/q24b4y6ojqdw',
[matplotlib] u'PNG_ID': u'png/q24b4y6ojqdwk2nwnblutd4qrjhmlmev',
[matplotlib] 'PWD': u'/local/certik/tmp/matplotlib-l6hpd5xi44vw-1',
[matplotlib] 'PYTHON': u'/local/certik/bld/python/m327azitptlv/bin/python',
[matplotlib] 'PYTHONDONTWRITEBYTECODE': u'yes',
[matplotlib] 'PYTHONPATH': u'/local/certik/bld/setuptools/cl5h5p575pm7/lib/python3.4/site-packages:/local/certik/bld/numpy/o7mh7o3cbu5s/lib/python3.4/site-packages',
[matplotlib] u'PYTHON_DIR': u'/local/certik/bld/python/m327azitptlv',
[matplotlib] u'PYTHON_ID': u'python/m327azitptlvocjp2othxwmlsqcmxu3i',
[matplotlib] u'SETUPTOOLS_DIR': u'/local/certik/bld/setuptools/cl5h5p575pm7',
[matplotlib] u'SETUPTOOLS_ID': u'setuptools/cl5h5p575pm7wzsnkqxnxgbiql45rrkl',
[matplotlib] u'ZLIB_DIR': u'/local/certik/bld/zlib/3el5ccejre7b',
[matplotlib] u'ZLIB_ID': u'zlib/3el5ccejre7bcjqgld5gp6iym4ccd5oe'}
[matplotlib] Traceback (most recent call last):
[matplotlib] File "<string>", line 1, in <module>
[matplotlib] File "<string>", line 155, in <module>
[matplotlib] File "/local/certik/tmp/matplotlib-l6hpd5xi44vw-1/setupext.py", line 1031, in check
[matplotlib] min_version='1.2', version=version)
[matplotlib] File "/local/certik/tmp/matplotlib-l6hpd5xi44vw-1/setupext.py", line 446, in _check_for_pkg_config
[matplotlib] if (not is_min_version(version, min_version)):
[matplotlib] File "/local/certik/tmp/matplotlib-l6hpd5xi44vw-1/setupext.py", line 174, in is_min_version
[matplotlib] return found_version >= expected_version
[matplotlib] File "/local/certik/bld/python/m327azitptlv/lib/python3.4/distutils/version.py", line 76, in __ge__
[matplotlib] c = self._cmp(other)
[matplotlib] File "/local/certik/bld/python/m327azitptlv/lib/python3.4/distutils/version.py", line 343, in _cmp
[matplotlib] if self.version < other.version:
[matplotlib] TypeError: unorderable types: str() < int()
[matplotlib] ============================================================================
[matplotlib] Edit setup.cfg to change the build options
[matplotlib]
[matplotlib] BUILDING MATPLOTLIB
[matplotlib] matplotlib: yes [1.4.2]
[matplotlib] python: yes [3.4.2 (default, Dec 4 2014, 10:45:52) [GCC
[matplotlib] 4.4.7 20120313 (Red Hat 4.4.7-11)]]
[matplotlib] platform: yes [linux]
[matplotlib]
[matplotlib] REQUIRED DEPENDENCIES AND EXTENSIONS
[matplotlib] numpy: yes [version 1.8.2]
[matplotlib] six: yes [six was not found.]
[matplotlib] dateutil: yes [dateutil was not found. It is required for date
[matplotlib] axis support. pip/easy_install may attempt to
[matplotlib] install it after matplotlib.]
[matplotlib] pytz: yes [pytz was not found. pip will attempt to install
[matplotlib] it after matplotlib.]
[matplotlib] tornado: yes [tornado was not found. It is required for the
[matplotlib] WebAgg backend. pip/easy_install may attempt to
[matplotlib] install it after matplotlib.]
[matplotlib] pyparsing: yes [pyparsing was not found. It is required for
[matplotlib] mathtext support. pip/easy_install may attempt to
[matplotlib] install it after matplotlib.]
[matplotlib] pycxx: yes [Official versions of PyCXX are not compatible
[matplotlib] with matplotlib on Python 3.x, since they lack
[matplotlib] support for the buffer object. Using local copy]
[matplotlib] libagg: yes [pkg-config information for 'libagg' could not
[matplotlib] be found. Using local copy.]
[matplotlib] freetype: yes [version 2.4.11]
[matplotlib|ERROR] Command '[u'/bin/bash', '_hashdist/build.sh']' returned non-zero exit status 1
[matplotlib|ERROR] command failed (code=1); raising

The issues #2087 and #3732 seem related.

It works in Python 2.7. The dependencies are exactly the same for 2.7 and 3.4. Here is the build script:

$ hit show python3.4.linux.yaml script matplotlib
set -e
export HDIST_IN_BUILD=yes
export CPPFLAGS="-I${BZIP2_DIR}/include -I${FREETYPE_DIR}/include -I${NUMPY_DIR}/include -I${PATCHELF_DIR}/include -I${PKG_CONFIG_DIR}/include -I${PNG_DIR}/include -I${PYTHON_DIR}/include -I${SETUPTOOLS_DIR}/include -I${ZLIB_DIR}/include"
export LDFLAGS="-L${BZIP2_DIR}/lib -Wl,-rpath=${BZIP2_DIR}/lib -L${FREETYPE_DIR}/lib -Wl,-rpath=${FREETYPE_DIR}/lib -L${NUMPY_DIR}/lib -Wl,-rpath=${NUMPY_DIR}/lib -L${PATCHELF_DIR}/lib -Wl,-rpath=${PATCHELF_DIR}/lib -L${PKG_CONFIG_DIR}/lib -Wl,-rpath=${PKG_CONFIG_DIR}/lib -L${PNG_DIR}/lib -Wl,-rpath=${PNG_DIR}/lib -L${PYTHON_DIR}/lib -Wl,-rpath=${PYTHON_DIR}/lib -L${SETUPTOOLS_DIR}/lib -Wl,-rpath=${SETUPTOOLS_DIR}/lib -L${ZLIB_DIR}/lib -Wl,-rpath=${ZLIB_DIR}/lib"

export PYTHONPATH=${ARTIFACT}/lib/python/site-packages:$PYTHONPATH
mkdir -p ${ARTIFACT}/lib/python/site-packages
${PYTHON} -c 'import setuptools; __file__="setup.py"; exec(open(__file__).read())' \
install \
--prefix=. --root=${ARTIFACT} \
--single-version-externally-managed

And I used the 1.4.2 tarball: https://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.4.2/matplotlib-1.4.2.tar.gz

And I use linux (RHEL6), though we build all the dependencies ourselves.