<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def install(self):
 """ Install the environment """

        self.phase = PHASE.INSTALL
        if not self.directory.new:
            self.logger.info("Namespace %s directory already exists!" % self.namespace)
            self.source = load_manifest(self.directory.manifest_path)
            return self.update()
        try:
            self.logger.info("Installing environment %s..." % self.namespace)
            self.directory.initialize()
            self.install_sandboxes()
            self.instantiate_features()
            self.grab_inputs()
            self._specialize()
            for feature in self.features.run_order:
                self.run_action(feature, 'sync')
            self.inject_environment_config()
            self._finalize()
        except Exception:
            self.logger.debug("", exc_info=sys.exc_info())
            self.logger.info("An error occured during installation!")
            if not self.ignore_errors:
                self.clear_all()
                self.logger.info("Removing installation %s..." % self.namespace)
                self.directory.remove()
                et, ei, tb = sys.exc_info()
                reraise(et, ei, tb)