# Buggy code
def explicit(
    specs, prefix, verbose=False, force_extract=True, index_args=None, index=None
):
    actions = defaultdict(list)
    actions["PREFIX"] = prefix

    fetch_recs = {}
    for spec in specs:
        if spec == "@EXPLICIT":
            continue

        if not is_url(spec):
            spec = unquote(path_to_url(expand(spec)))

        # parse URL
        m = url_pat.match(spec)
        if m is None:
            raise ParseError("Could not parse explicit URL: %s" % spec)
        url_p, fn, md5sum = m.group("url_p"), m.group("fn"), m.group("md5")
        url = join_url(url_p, fn)
        # url_p is everything but the tarball_basename and the md5sum

        # If the path points to a file in the package cache, we need to use
        # the dist name that corresponds to that package. The MD5 may not
        # match, but we will let PFE below worry about that
        dist = None
        if url.startswith("file:/"):
            path = win_path_ok(url_to_path(url))
            if dirname(path) in context.pkgs_dirs:
                if not exists(path):
                    raise CondaFileNotFoundError(path)
                pc_entry = PackageCache.tarball_file_in_cache(path)
                dist = pc_entry.dist
                url = dist.to_url() or pc_entry.get_urls_txt_value()
                md5sum = md5sum or pc_entry.md5sum
        dist = dist or Dist(url)
        fetch_recs[dist] = {"md5": md5sum, "url": url}

    # perform any necessary fetches and extractions
    if verbose:
        from .console import setup_verbose_handlers

        setup_verbose_handlers()
    link_dists = tuple(iterkeys(fetch_recs))
    pfe = ProgressiveFetchExtract(fetch_recs, link_dists)
    pfe.execute()

    # dists could have been updated with more accurate urls
    # TODO: I'm stuck here

    # Now get the index---but the only index we need is the package cache
    index = {}
    _supplement_index_with_cache(index, ())

    # unlink any installed packages with same package name
    link_names = {index[d]["name"] for d in link_dists}
    actions[UNLINK].extend(
        d for d, r in iteritems(linked_data(prefix)) if r["name"] in link_names
    )

    # need to get the install order right, especially to install python in the prefix
    #  before python noarch packages
    r = Resolve(index)
    actions[LINK].extend(link_dists)
    actions[LINK] = r.dependency_sort(
        {r.package_name(dist): dist for dist in actions[LINK]}
    )
    actions["ACTION"] = "EXPLICIT"

    execute_actions(actions, index, verbose=verbose)
    return actions


# Traceback (conda.exceptions.CondaFileNotFoundError)
Traceback (most recent call last):
File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 502, in _execute_action
action.execute()
File "/conda/lib/python3.6/site-packages/conda/core/path_actions.py", line 739, in execute
source_md5sum = compute_md5sum(source_path)
File "/conda/lib/python3.6/site-packages/conda/gateways/disk/read.py", line 59, in compute_md5sum
raise CondaFileNotFoundError(file_full_path)
conda.exceptions.CondaFileNotFoundError: <unprintable CondaFileNotFoundError object>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/conda/lib/python3.6/site-packages/conda/exceptions.py", line 592, in conda_exception_handler
return_value = func(*args, **kwargs)
File "/conda/lib/python3.6/site-packages/conda/cli/main.py", line 134, in _main
exit_code = args.func(args, p)
File "/conda/lib/python3.6/site-packages/conda/cli/main_install.py", line 80, in execute
install(args, parser, 'install')
File "/conda/lib/python3.6/site-packages/conda/cli/install.py", line 200, in install
explicit(args.packages, prefix, verbose=not context.quiet)
File "/conda/lib/python3.6/site-packages/conda/misc.py", line 90, in explicit
pfe.execute()
File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 491, in execute
self._execute_action(action)
File "/conda/lib/python3.6/site-packages/conda/core/package_cache.py", line 507, in _execute_action
exceptions.append(CondaError(repr(e)))
File "/conda/lib/python3.6/site-packages/conda/__init__.py", line 43, in __repr__
return '%s: %s\n' % (self.__class__.__name__, text_type(self))
File "/conda/lib/python3.6/site-packages/conda/__init__.py", line 48, in __str__
return text_type(self.message % self._kwargs)
TypeError: must be real number, not dict

# Fixed code
def explicit(
    specs, prefix, verbose=False, force_extract=True, index_args=None, index=None
):
    actions = defaultdict(list)
    actions["PREFIX"] = prefix

    fetch_recs = {}
    for spec in specs:
        if spec == "@EXPLICIT":
            continue

        if not is_url(spec):
            spec = unquote(path_to_url(expand(spec)))

        # parse URL
        m = url_pat.match(spec)
        if m is None:
            raise ParseError("Could not parse explicit URL: %s" % spec)
        url_p, fn, md5sum = m.group("url_p"), m.group("fn"), m.group("md5")
        url = join_url(url_p, fn)
        # url_p is everything but the tarball_basename and the md5sum

        # If the path points to a file in the package cache, we need to use
        # the dist name that corresponds to that package. The MD5 may not
        # match, but we will let PFE below worry about that
        dist = None
        if url.startswith("file:/"):
            path = win_path_ok(url_to_path(url))
            if dirname(path) in context.pkgs_dirs:
                if not exists(path):
                    raise FileNotFoundError(path)
                pc_entry = PackageCache.tarball_file_in_cache(path)
                dist = pc_entry.dist
                url = dist.to_url() or pc_entry.get_urls_txt_value()
                md5sum = md5sum or pc_entry.md5sum
        dist = dist or Dist(url)
        fetch_recs[dist] = {"md5": md5sum, "url": url}

    # perform any necessary fetches and extractions
    if verbose:
        from .console import setup_verbose_handlers

        setup_verbose_handlers()
    link_dists = tuple(iterkeys(fetch_recs))
    pfe = ProgressiveFetchExtract(fetch_recs, link_dists)
    pfe.execute()

    # dists could have been updated with more accurate urls
    # TODO: I'm stuck here

    # Now get the index---but the only index we need is the package cache
    index = {}
    _supplement_index_with_cache(index, ())

    # unlink any installed packages with same package name
    link_names = {index[d]["name"] for d in link_dists}
    actions[UNLINK].extend(
        d for d, r in iteritems(linked_data(prefix)) if r["name"] in link_names
    )

    # need to get the install order right, especially to install python in the prefix
    #  before python noarch packages
    r = Resolve(index)
    actions[LINK].extend(link_dists)
    actions[LINK] = r.dependency_sort(
        {r.package_name(dist): dist for dist in actions[LINK]}
    )
    actions["ACTION"] = "EXPLICIT"

    execute_actions(actions, index, verbose=verbose)
    return actions