class_docstr: Check, install, and call TLGU.
docstr: Check if tlgu installed, if not install it.
docstr_tok: ["Check","if","tlgu","installed",",","if","not","install","it","."]
code: def _check_install(self):
      """Check if tlgu installed, if not install it."""
      try:
          subprocess.check_output(["which", "tlgu"])
      except subprocess.SubprocessError as sub_err:
          print("TLGU not installed.")
          logger.info("TLGU not installed: %s", sub_err)
          logger.info("Installing TLGU.")
          if not subprocess.check_output(["which", "gcc"]):
              logger.error("GCC seems not to be installed.")
          else:
              tlgu_path = make_cltk_path(
                  "grc/software/grc_software_tlgu"
              )
              if self.interactive:
                  install_question = "Do you want to install TLGU?"
                  do_install = query_yes_no(question=install_question)
                  if not do_install:
                      raise CLTKException(
                          "TLGU installation required for this class to work."
                      )
              else:
                  print("Non-interactive installation. Continuing ...")
              command = "cd {0} && make install".format(tlgu_path)
              print(f"Going to run command: ``{command}``")
              try:
                  p_out = subprocess.call(command, shell=True)
              except subprocess.SubprocessError as sub_err:
                  print(
                      "Error executing installation. Going to check output of ``subprocess.call()`` ..."
                  )
                  raise CLTKException(sub_err)
              if p_out == 0:
                  msg = "TLGU installed."
                  print(msg)
                  logger.info(msg)
                  return True
              else:
                  msg = "TLGU install without sudo failed. Going to try again with sudo (usually required for Linux) ..."
                  print(msg)
                  logger.error(msg)
              command = "cd {0} && sudo make install".format(tlgu_path)
              if self.interactive:
                  install_question = (
                      "Do you want to install TLGU? with sudo?"
                  )
                  do_install = query_yes_no(question=install_question)
                  if not do_install:
                      raise CLTKException(
                          "TLGU installation required for this class to work."
                      )
                  p_out = subprocess.call(command, shell=True)
              else:
                  print("Going to run command:", command)
                  p_out = subprocess.call(command, shell=True)
              if p_out == 0:
                  msg = "TLGU installed."
                  print(msg)
                  logger.info(msg)
              else:
                  msg = "TLGU install with sudo failed."
                  print(msg)
                  logger.error(msg)
                  raise CLTKException(
                      "TLGU installation required for this class to work."
                  )
  
file_path: cltk/src/cltk/corpora/grc/tlg/tlgu.py
imports: import os
  import subprocess
  from cltk.core.cltk_logger import logger
  from cltk.core.exceptions import CLTKException
  from cltk.data.fetch import FetchCorpus
  from cltk.utils.file_operations import make_cltk_path
  from cltk.utils.utils import query_yes_no
label_desc: Use image node_id 3 for calling the TLGU obj's underlying member method code with example usage: obj._check_install() and returns: True