class_docstr: LocalModuleManager is used to manage PaddleHub's local Module, which supports the installation, uninstallation,
  and search of HubModule. LocalModuleManager is a singleton object related to the path, in other words, when the
  LocalModuleManager object of the same home directory is generated multiple times, the same object is returned.
  
  Args:
      home (str): The directory where PaddleHub modules are stored, the default is ~/.paddlehub/modules
class_docstr_tok: ["LocalModuleManager","is","used","to","manage","PaddleHub","'s","local","Module",",","which","supports","the","installation",",","uninstallation",",","and","search","of","HubModule",".","LocalModuleManager","is","a","singleton","object","related","to","the","path",",","in","other","words",",","when","the","LocalModuleManager","object","of","the","same","home","directory","is","generated","multiple","times",",","the","same","object","is","returned",".","Args",":","home","(","str",")",":","The","directory","where","PaddleHub","modules","are","stored",",","the","default","is","~\/.paddlehub\/modules"]
docstr: Install a HubModule from directory containing module.py
docstr_tok: ["Install","a","HubModule","from","directory","containing","module.py"]
code: def _install_from_directory(self, directory: str) -> HubModule:
      """Install a HubModule from directory containing module.py"""
      module_info = HubModule.load_module_info(directory)
  
      # A temporary directory is copied here for two purposes:
      # 1. Avoid affecting user-specified directory (for example, a __pycache__
      #    directory will be generated).
      # 2. HubModule is essentially a python package. When internal package
      #    references are made in it, the correct package name is required.
      with utils.generate_tempdir() as _dir:
          tempdir = os.path.join(_dir, module_info.name)
          tempdir = self._get_normalized_name(tempdir)
          shutil.copytree(directory, tempdir)
  
          # Uninstall local module
          if os.path.exists(
              self._get_normalized_path(module_info.name)
          ):
              self.uninstall(module_info.name)
  
          shutil.copytree(
              directory, self._get_normalized_path(module_info.name)
          )
  
          # Install python package requirements, This behavior needs to occur before Module.load,
          # otherwise the model will fail to load due to missing dependencies.
          self._install_module_requirements(directory)
  
          hub_module_cls = HubModule.load(
              self._get_normalized_path(module_info.name)
          )
          self._local_modules[module_info.name] = hub_module_cls
  
          log.logger.info(
              "Successfully installed {}-{}".format(
                  hub_module_cls.name, hub_module_cls.version
              )
          )
          return hub_module_cls
  
imports: import os
  import shutil
  import sys
  from collections import OrderedDict
  from typing import List
  import filelock
  from paddlehub.env import MODULE_HOME, TMP_HOME
  from paddlehub.module.module import Module
  from paddlehub.server import module_server
  from paddlehub.utils import xarfile, log, utils, pypi
label_desc: Use image node_id 12 for calling the LocalModuleManager obj's underlying member method code with example usage: obj._install_from_directory(directory) and returns: hub_module_cls