Attempt to upgrade all packages installed with --user

def pip_upgrade_all_user(line):
    """Attempt to upgrade all packages installed with --user"""
    import pip
    for dist in pip.get_installed_distributions(user_only=True):
        do_pip(["install", "--upgrade", "--user", dist.project_name])