code: def require(packages):
      """Ensures that a pypi package has been installed into the App's python environment.
      If not, the package will be installed and your env will be rebooted.
  
      Example:
          ::
  
              lore.env.require('pandas')
              # -> pandas is required. Dependencies added to requirements.txt
  
      :param packages: requirements.txt style name and versions of packages
      :type packages: [unicode]
  
      """
      global INSTALLED_PACKAGES, _new_requirements
  
      if _new_requirements:
          INSTALLED_PACKAGES = None
  
      set_installed_packages()
      if not INSTALLED_PACKAGES:
          return
  
      if not isinstance(packages, list):
          packages = [packages]
  
      missing = []
      for package in packages:
          name = re.split(r"[!<>=]", package)[0].lower()
          if normalize_package_name(name) not in INSTALLED_PACKAGES:
              print(ansi.info() + " %s is required." % package)
              missing += [package]
  
      if missing:
          mode = "a" if os.path.exists(REQUIREMENTS) else "w"
          with open(REQUIREMENTS, mode) as requirements:
              requirements.write("\n" + "\n".join(missing) + "\n")
          print(
              ansi.info()
              + " Dependencies added to requirements.txt. Rebooting."
          )
          _new_requirements = True
          import lore.__main__
  
          lore.__main__.install(None, None)
          reboot("--env-checked")
  
imports: from __future__ import absolute_import, print_function, unicode_literals
  import glob
  import locale
  import os
  import re
  import socket
  import subprocess
  import sys
  import platform
  from io import open
  import pkg_resources
  from lore import ansi
label_desc: Use image node_id 1 for calling a global function with example usage: require(packages) without return types