code: def install_package(package, upgrade=True,
                      target=None):
      
      # Not using 'import pip; pip.main([])' because it breaks the logger
      with INSTALL_LOCK:
          if check_package_exists(package, target):
              return True
  
          _LOGGER.info('Attempting install of %s', package)
          args = [sys.executable, '-m', 'pip', 'install', '--quiet', package]
          if upgrade:
              args.append('--upgrade')
          if target:
              args += ['--target', os.path.abspath(target)]
  
          try:
              return subprocess.call(args) == 0
          except subprocess.SubprocessError:
              _LOGGER.exception('Unable to install pacakge %s', package)
              return False
docs: Install a package on PyPi. Accepts pip compatible package strings.
  
      Return boolean if install successful.