diff --git a/.travis.yml b/.travis.yml
index 05dfe1fc181d9bea4c849a9c55981025abc4dd9f..54f55711eb95c63eba8e5d935434045118be8713 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,9 +20,9 @@ before_install:
 - if [ -n "${NUMPYSPEC}" ]; then sudo apt-get install -qq gfortran; fi
 - if [ -n "${NUMPYSPEC}" ]; then pip install --upgrade pip setuptools; fi
 - if [ -n "${NUMPYSPEC}" ]; then pip install --find-links http://wheels.astropy.org/ --find-links http://wheels2.astropy.org/ --use-wheel numpy$NUMPYSPEC; fi
-- pip install --find-links http://wheels.astropy.org/ --find-links http://wheels2.astropy.org/ --use-wheel sphinx nose==1.3.0 jinja2==2.6 cpp-coveralls pygments==1.6 setuptools==7.0
+- pip install --find-links http://wheels.astropy.org/ --find-links http://wheels2.astropy.org/ --use-wheel sphinx nose==1.3.0 jinja2==2.6 cpp-coveralls pygments==1.6
 install:
-- python bootstrap.py
+- python bootstrap-buildout.py
 - CFLAGS=-coverage ./bin/buildout
 script:
 - ./bin/python -c 'from bob.io.base import get_config; print(get_config())'
diff --git a/bootstrap.py b/bootstrap-buildout.py
similarity index 72%
rename from bootstrap.py
rename to bootstrap-buildout.py
index 3995f07007539668ab18ec783a6def6651bb1f8f..a629566735c1c84fbec7173f0f30015b2b432512 100644
--- a/bootstrap.py
+++ b/bootstrap-buildout.py
@@ -56,6 +56,11 @@ parser.add_option("-c", "--config-file",
                         "file to be used."))
 parser.add_option("-f", "--find-links",
                   help=("Specify a URL to search for buildout releases"))
+parser.add_option("--allow-site-packages",
+                  action="store_true", default=False,
+                  help=("Let bootstrap.py use existing site packages"))
+parser.add_option("--setuptools-version",
+                  help="use a specific setuptools version")
 
 
 options, args = parser.parse_args()
@@ -63,45 +68,42 @@ options, args = parser.parse_args()
 ######################################################################
 # load/install setuptools
 
-to_reload = False
 try:
-    import pkg_resources
-    import setuptools
+    if options.allow_site_packages:
+        import setuptools
+        import pkg_resources
+    from urllib.request import urlopen
 except ImportError:
-    ez = {}
-
-    try:
-        from urllib.request import urlopen
-    except ImportError:
-        from urllib2 import urlopen
-
-    # XXX use a more permanent ez_setup.py URL when available.
-    exec(urlopen('https://bitbucket.org/pypa/setuptools/raw/0.7.2/ez_setup.py'
-                ).read(), ez)
-    setup_args = dict(to_dir=tmpeggs, download_delay=0)
-    ez['use_setuptools'](**setup_args)
-
-    if to_reload:
-        reload(pkg_resources)
-    import pkg_resources
-    # This does not (always?) update the default working set.  We will
-    # do it.
-    for path in sys.path:
-        if path not in pkg_resources.working_set.entries:
-            pkg_resources.working_set.add_entry(path)
+    from urllib2 import urlopen
 
-######################################################################
-# Try to best guess the version of buildout given setuptools
-if options.version is None:
-
-  try:
-    from distutils.version import LooseVersion
-    package = pkg_resources.require('setuptools')[0]
-    v = LooseVersion(package.version)
-    if v < LooseVersion('0.7'):
-      options.version = '2.1.1'
-  except:
-    pass
+ez = {}
+exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)
+
+if not options.allow_site_packages:
+    # ez_setup imports site, which adds site packages
+    # this will remove them from the path to ensure that incompatible versions
+    # of setuptools are not in the path
+    import site
+    # inside a virtualenv, there is no 'getsitepackages'.
+    # We can't remove these reliably
+    if hasattr(site, 'getsitepackages'):
+        for sitepackage_path in site.getsitepackages():
+            sys.path[:] = [x for x in sys.path if sitepackage_path not in x]
+
+setup_args = dict(to_dir=tmpeggs, download_delay=0)
+
+if options.setuptools_version is not None:
+    setup_args['version'] = options.setuptools_version
+
+ez['use_setuptools'](**setup_args)
+import setuptools
+import pkg_resources
+
+# This does not (always?) update the default working set.  We will
+# do it.
+for path in sys.path:
+    if path not in pkg_resources.working_set.entries:
+        pkg_resources.working_set.add_entry(path)
 
 ######################################################################
 # Install buildout
@@ -132,10 +134,15 @@ if version is None and not options.accept_buildout_test_releases:
     _final_parts = '*final-', '*final'
 
     def _final_version(parsed_version):
-        for part in parsed_version:
-            if (part[:1] == '*') and (part not in _final_parts):
-                return False
-        return True
+        try:
+            return not parsed_version.is_prerelease
+        except AttributeError:
+            # Older setuptools
+            for part in parsed_version:
+                if (part[:1] == '*') and (part not in _final_parts):
+                    return False
+            return True
+
     index = setuptools.package_index.PackageIndex(
         search_path=[setuptools_path])
     if find_links:
@@ -162,8 +169,7 @@ cmd.append(requirement)
 import subprocess
 if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
     raise Exception(
-        "Failed to execute command:\n%s",
-        repr(cmd)[1:-1])
+        "Failed to execute command:\n%s" % repr(cmd)[1:-1])
 
 ######################################################################
 # Import and run buildout
@@ -181,4 +187,3 @@ if options.config_file is not None:
 
 zc.buildout.buildout.main(args)
 shutil.rmtree(tmpeggs)
-
diff --git a/setup.py b/setup.py
index 06384128d23b829d03941344a32256eee5dd2d41..ec03a373a1b7ddbe5e7758009b30cb7daa09b3e6 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,6 @@ bob_packages = ['bob.core']
 
 from setuptools import setup, find_packages, dist
 dist.Distribution(dict(setup_requires=['bob.extension', 'bob.blitz'] + bob_packages))
-from bob.extension.utils import egrep, find_header, find_library
 from bob.blitz.extension import Extension, Library, build_ext
 
 from bob.extension.utils import load_requirements
@@ -16,119 +15,9 @@ build_requires = load_requirements()
 # Define package version
 version = open("version.txt").read().rstrip()
 
-packages = ['boost']
+packages = ['boost', 'hdf5']
 boost_modules = ['system', 'filesystem']
 
-import os
-def libhdf5_version(header):
-
-  vv = egrep(header, r"#\s*define\s+H5_VERSION\s+\"([\d\.]+)\"")
-  if not len(vv): return None
-  return vv[0].group(1)
-
-class hdf5:
-
-  def __init__ (self, requirement='', only_static=False):
-    """
-    Searches for libhdf5 in stock locations. Allows user to override.
-
-    If the user sets the environment variable BOB_PREFIX_PATH, that prefixes
-    the standard path locations.
-
-    Parameters:
-
-    requirement, str
-      A string, indicating a version requirement for this library. For example,
-      ``'>= 8.2'``.
-
-    only_static, boolean
-      A flag, that indicates if we intend to link against the static library
-      only. This will trigger our library search to disconsider shared
-      libraries when searching.
-    """
-    import os
-
-    self.name = 'hdf5'
-    header = 'hdf5.h'
-
-    candidates = find_header(header)
-
-    if not candidates:
-      raise RuntimeError("could not find %s's `%s' - have you installed %s on this machine?" % (self.name, header, self.name))
-
-    found = False
-
-    if not requirement:
-      self.include_directory = os.path.dirname(candidates[0])
-      directory = os.path.dirname(candidates[0])
-      version_header = os.path.join(directory, 'H5pubconf.h')
-      self.version = libhdf5_version(version_header)
-      found = True
-
-    else:
-
-      # requirement is 'operator' 'version'
-      operator, required = [k.strip() for k in requirement.split(' ', 1)]
-
-      # now check for user requirements
-      for candidate in candidates:
-        directory = os.path.dirname(candidate)
-        version_header = os.path.join(directory, 'H5pubconf.h')
-        vv = libhdf5_version(version_header)
-        available = LooseVersion(vv)
-        if (operator == '<' and available < required) or \
-           (operator == '<=' and available <= required) or \
-           (operator == '>' and available > required) or \
-           (operator == '>=' and available >= required) or \
-           (operator == '==' and available == required):
-          self.include_directory = os.path.dirname(candidate)
-          self.version = vv
-          found = True
-          break
-
-    if not found:
-      raise RuntimeError("could not find the required (%s) version of %s on the file system (looked at: %s)" % (requirement, self.name, ', '.join(candidates)))
-
-    # normalize
-    self.include_directory = os.path.normpath(self.include_directory)
-
-    # find library
-    prefix = os.path.dirname(os.path.dirname(self.include_directory))
-    module = 'hdf5'
-    candidates = find_library(module, version=self.version, prefixes=[prefix], only_static=only_static)
-
-    if not candidates:
-      raise RuntimeError("cannot find required %s binary module `%s' - make sure libhdf5 is installed on `%s'" % (self.name, module, prefix))
-
-    # libraries
-    self.libraries = []
-    name, ext = os.path.splitext(os.path.basename(candidates[0]))
-    if ext in ['.so', '.a', '.dylib', '.dll']:
-      self.libraries.append(name[3:]) #strip 'lib' from the name
-    else: #link against the whole thing
-      self.libraries.append(':' + os.path.basename(candidates[0]))
-
-    # library path
-    self.library_directory = os.path.dirname(candidates[0])
-
-  def macros(self):
-    return [
-        ('HAVE_%s' % self.name.upper(), '1'),
-        ('%s_VERSION' % self.name.upper(), '"%s"' % self.version),
-        ]
-
-
-hdf5_pkg = hdf5()
-
-system_include_dirs = [hdf5_pkg.include_directory]
-
-library_dirs = [hdf5_pkg.library_directory]
-
-libraries = hdf5_pkg.libraries
-
-define_macros = hdf5_pkg.macros()
-
-
 setup(
 
     name='bob.io.base',
@@ -158,8 +47,6 @@ setup(
         [
           "bob/io/base/version.cpp",
         ],
-        define_macros = define_macros,
-        system_include_dirs = system_include_dirs,
         version = version,
         bob_packages = bob_packages,
         packages = packages,
@@ -188,10 +75,6 @@ setup(
           "bob/io/base/cpp/array_type.cpp",
           "bob/io/base/cpp/blitz_array.cpp",
         ],
-        libraries = libraries,
-        library_dirs = library_dirs,
-        system_include_dirs = system_include_dirs,
-        define_macros = define_macros,
         version = version,
         bob_packages = bob_packages,
         packages = packages,
@@ -206,10 +89,6 @@ setup(
           "bob/io/base/hdf5.cpp",
           "bob/io/base/main.cpp",
         ],
-        library_dirs = library_dirs,
-        libraries = libraries,
-        define_macros = define_macros,
-        system_include_dirs = system_include_dirs,
         version = version,
         bob_packages = bob_packages,
         packages = packages,