diff --git a/var/spack/repos/builtin/packages/tau/package.py b/var/spack/repos/builtin/packages/tau/package.py
index d6b0a98d67b5e14b731fb5d754731f61572375f5..991841f137bc57be9f30a9c7eac541d234af64bd 100644
--- a/var/spack/repos/builtin/packages/tau/package.py
+++ b/var/spack/repos/builtin/packages/tau/package.py
@@ -150,4 +150,11 @@ def link_tau_arch_dirs(self):
def setup_environment(self, spack_env, run_env):
pattern = join_path(self.prefix.lib, 'Makefile.*')
files = glob.glob(pattern)
- run_env.set('TAU_MAKEFILE', files[0])
+
+ # This function is called both at install time to set up
+ # the build environment and after install to generate the associated
+ # module file. In the former case there is no `self.prefix.lib`
+ # directory to inspect. The conditional below will set `TAU_MAKEFILE`
+ # in the latter case.
+ if files:
+ run_env.set('TAU_MAKEFILE', files[0])