diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 5e24bc9d8e..f8c93fe37b 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2826,7 +2826,7 @@ def activate(self, path=None, replace=False): if path is None: path = sys.path self.insert_on(path, replace=replace) - if path is sys.path: + if path is sys.path and self.location is not None: fixup_namespace_packages(self.location) for pkg in self._get_metadata('namespace_packages.txt'): if pkg in sys.modules: