Executes the install functionality.

    If requirements is True, simply spits out a requirements format to stdout.

def do_install_dependencies(
    dev=False,
    only=False,
    bare=False,
    requirements=False,
    allow_global=False,
    ignore_hashes=False,
    skip_lock=False,
    concurrent=True,
    requirements_dir=None,
    pypi_mirror=False,
):
    """"
    Executes the install functionality.

    If requirements is True, simply spits out a requirements format to stdout.
    """

    from six.moves import queue
    if requirements:
        bare = True
    blocking = not concurrent
    # Load the lockfile if it exists, or if only is being used (e.g. lock is being used).
    if skip_lock or only or not project.lockfile_exists:
        if not bare:
            click.echo(
                crayons.normal(fix_utf8("Installing dependencies from Pipfile…"), bold=True)
            )
            # skip_lock should completely bypass the lockfile (broken in 4dac1676)
            lockfile = project.get_or_create_lockfile(from_pipfile=True)
    else:
        lockfile = project.get_or_create_lockfile()
        if not bare:
            click.echo(
                crayons.normal(
                    fix_utf8("Installing dependencies from Pipfile.lock ({0})…".format(
                        lockfile["_meta"].get("hash", {}).get("sha256")[-6:]
                    )),
                    bold=True,
                )
            )
    # Allow pip to resolve dependencies when in skip-lock mode.
    no_deps = not skip_lock
    deps_list = list(lockfile.get_requirements(dev=dev, only=requirements))
    if requirements:
        index_args = prepare_pip_source_args(project.sources)
        index_args = " ".join(index_args).replace(" -", "\n-")
        deps = [
            req.as_line(sources=False, include_hashes=False) for req in deps_list
        ]
        # Output only default dependencies
        click.echo(index_args)
        click.echo(
            "\n".join(sorted(deps))
        )
        sys.exit(0)

    procs = queue.Queue(maxsize=PIPENV_MAX_SUBPROCESS)
    failed_deps_queue = queue.Queue()
    if skip_lock:
        ignore_hashes = True

    install_kwargs = {
        "no_deps": no_deps, "ignore_hashes": ignore_hashes, "allow_global": allow_global,
        "blocking": blocking, "pypi_mirror": pypi_mirror
    }
    if concurrent:
        install_kwargs["nprocs"] = PIPENV_MAX_SUBPROCESS
    else:
        install_kwargs["nprocs"] = 1

    # with project.environment.activated():
    batch_install(
        deps_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
    )

    if not procs.empty():
        _cleanup_procs(procs, concurrent, failed_deps_queue)

    # Iterate over the hopefully-poorly-packaged dependencies…
    if not failed_deps_queue.empty():
        click.echo(
            crayons.normal(fix_utf8("Installing initially failed dependencies…"), bold=True)
        )
        retry_list = []
        while not failed_deps_queue.empty():
            failed_dep = failed_deps_queue.get()
            retry_list.append(failed_dep)
        install_kwargs.update({
            "nprocs": 1,
            "retry": False,
            "blocking": True,
        })
        batch_install(
            retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
        )
    if not procs.empty():
        _cleanup_procs(procs, False, failed_deps_queue, retry=False)