def install_requirement(virtualenv_path, requirement, proxy_config=None, logger=None):
    """
    Install a single requirement.

    :param requirement: Requirement specifier.
    """
    logger = logger or LOG
    pip_path = os.path.join(virtualenv_path, "bin/pip")
    pip_opts = cfg.CONF.actionrunner.pip_opts or []
    cmd = [pip_path]

    if proxy_config:
        cert = proxy_config.get("proxy_ca_bundle_path", None)
        https_proxy = proxy_config.get("https_proxy", None)
        http_proxy = proxy_config.get("http_proxy", None)

        if http_proxy:
            cmd.extend(["--proxy", http_proxy])

        if https_proxy:
            cmd.extend(["--proxy", https_proxy])

        if cert:
            cmd.extend(["--cert", cert])

    cmd.append("install")
    cmd.extend(pip_opts)
    cmd.extend([requirement])
    env = get_env_for_subprocess_command()
    logger.debug(
        "Installing requirement %s with command %s.", requirement, " ".join(cmd)
    )
    exit_code, stdout, stderr = run_command(cmd=cmd, env=env)

    # Normally we don't want this, even in debug logs. But it is useful to
    # investigate pip behavior changes & broken virtualenv integration tests.
    # logger.debug(f"\npip stdout=\n{stdout}")

    if exit_code != 0:
        raise Exception(
            'Failed to install requirement "%s": %s' % (requirement, stdout)
        )

    return True

    Install a single requirement.

    :param requirement: Requirement specifier.
    
st2common/st2common/util/virtualenvs.py