input: Write a python function to install the listed Python packages using pip commands.
  assert install_packages() == "Packages installed successfully"
  assert install_packages() == "Packages already installed"
output: def install_packages():
      import subprocess
      import sys
  
      packages = ["requests", "numpy", "pandas"]
  
      def install(package):
          subprocess.check_call([sys.executable, "-m", "pip", "install", package])
  
      installed_packages = subprocess.check_output([sys.executable, "-m", "pip", "freeze"])
      installed_packages = [pkg.split('==')[0] for pkg in installed_packages.decode().split('\n')]
  
      try:
          for package in packages:
              if package not in installed_packages:
                  install(package)
          return "Packages installed successfully"
      except subprocess.CalledProcessError:
          return "Error installing packages"
  
      return "Packages already installed"