code: def pip_upgrade_all(line):
      
      from pip import get_installed_distributions
      user = set(d.project_name for d in get_installed_distributions(user_only=True))
      all = set(d.project_name for d in get_installed_distributions())
      for dist in all - user:
          do_pip(["install", "--upgrade", dist])
      for dist in  user:
          do_pip(["install", "--upgrade", "--user", dist])
docs: Attempt to upgrade all packages