diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py
index e9bd07d92cab1bcf5549dec1c4c1dd0a1505df20..80ebf6a2cf105e2070d0524a16852f263dbef59d 100644
--- a/lib/spack/spack/database.py
+++ b/lib/spack/spack/database.py
@@ -468,7 +468,7 @@ def _add(self, spec, directory_layout=None, explicit=False):
         if key not in self._data:
             installed = False
             path = None
-            if directory_layout:
+            if not spec.external and directory_layout:
                 path = directory_layout.path_for_spec(spec)
                 try:
                     directory_layout.check_installed(spec)