def create_virtualenv(
    virtualenv_path,
    logger=None,
    include_pip=True,
    include_setuptools=True,
    include_wheel=True,
    no_download=True,
):
    """
    :param include_pip: Include pip binary and package in the newely created virtual environment.
    :type include_pip: ``bool``

    :param include_setuptools: Include setuptools binary and package in the newely created virtual
                               environment.
    :type include_setuptools: ``bool``

    :param include_wheel: Include wheel in the newely created virtual environment.
    :type include_wheel : ``bool``

    :param no_download: Do not download and install latest version of pre-installed packages such
                        as pip and setuptools.
    :type no_download: ``bool``
    """

    logger = logger or LOG

    python_binary = cfg.CONF.actionrunner.python_binary
    virtualenv_binary = cfg.CONF.actionrunner.virtualenv_binary
    virtualenv_opts = cfg.CONF.actionrunner.virtualenv_opts or []
    virtualenv_opts += ["--verbose"]

    if not os.path.isfile(python_binary):
        raise Exception('Python binary "%s" doesn\'t exist' % (python_binary))

    if not os.path.isfile(virtualenv_binary):
        raise Exception('Virtualenv binary "%s" doesn\'t exist.' % (virtualenv_binary))

    logger.debug(
        'Creating virtualenv in "%s" using Python binary "%s"'
        % (virtualenv_path, python_binary)
    )

    cmd = [virtualenv_binary]

    cmd.extend(["-p", python_binary])

    cmd.extend(virtualenv_opts)

    if not include_pip:
        cmd.append("--no-pip")

    if not include_setuptools:
        cmd.append("--no-setuptools")

    if not include_wheel:
        cmd.append("--no-wheel")

    if no_download:
        cmd.append("--no-download")

    cmd.extend([virtualenv_path])
    logger.debug('Running command "%s" to create virtualenv.', " ".join(cmd))

    try:
        exit_code, stdout, stderr = run_command(cmd=cmd)
    except OSError as e:
        raise Exception(
            "Error executing command %s. %s." % (" ".join(cmd), six.text_type(e))
        )

    if exit_code != 0:
        raise Exception(
            'Failed to create virtualenv in "%s":\n stdout=%s\n stderr=%s'
            % (virtualenv_path, stdout, stderr)
        )

    return True

    :param include_pip: Include pip binary and package in the newely created virtual environment.
    :type include_pip: ``bool``

    :param include_setuptools: Include setuptools binary and package in the newely created virtual
                               environment.
    :type include_setuptools: ``bool``

    :param include_wheel: Include wheel in the newely created virtual environment.
    :type include_wheel : ``bool``

    :param no_download: Do not download and install latest version of pre-installed packages such
                        as pip and setuptools.
    :type no_download: ``bool``
    
st2common/st2common/util/virtualenvs.py