# Buggy code
def download(
    self,
    from_infos,
    to_infos,
    no_progress_bar=False,
    names=None,
    resume=False,
):
    names = self._verify_path_args(to_infos, from_infos, names)

    for to_info, from_info, name in zip(to_infos, from_infos, names):
        if from_info.scheme not in ["http", "https"]:
            raise NotImplementedError

        if to_info.scheme != "local":
            raise NotImplementedError

        msg = "Downloading '{}' to '{}'".format(from_info.path, to_info.path)
        logger.debug(msg)

        if not name:
            name = os.path.basename(to_info.path)

        makedirs(os.path.dirname(to_info.path), exist_ok=True)

        total = self._content_length(from_info.path)

        if no_progress_bar or not total:
            cb = None
        else:
            cb = ProgressBarCallback(name, total)

        try:
            self._download_to(from_info.path, to_info.path, callback=cb, resume=resume)

        except Exception:
            msg = "failed to download '{}'".format(from_info.path)
            logger.exception(msg)
            continue

        if not no_progress_bar:
            progress.finish_target(name)


# Traceback (AssertionError)
(base) ➜  example git:(master) ✗ dvc import -v https://mibig.secondarymetabolites.org/mibig_json_1.4.tar.gz
DEBUG: PRAGMA user_version;
DEBUG: fetched: [(3,)]
DEBUG: CREATE TABLE IF NOT EXISTS state (inode INTEGER PRIMARY KEY, mtime TEXT NOT NULL, size TEXT NOT NULL, md5 TEXT NOT NULL, timestamp TEXT NOT NULL)
DEBUG: CREATE TABLE IF NOT EXISTS state_info (count INTEGER)
DEBUG: CREATE TABLE IF NOT EXISTS link_state (path TEXT PRIMARY KEY, inode INTEGER NOT NULL, mtime TEXT NOT NULL)
DEBUG: INSERT OR IGNORE INTO state_info (count) SELECT 0 WHERE NOT EXISTS (SELECT * FROM state_info)
DEBUG: PRAGMA user_version = 3;
DEBUG: Skipping copying for '/Users/prihodad/Documents/projects/dvc2-example/example/mibig_json_1.4.tar.gz', since it is not a symlink or a hardlink.
DEBUG: SELECT count from state_info WHERE rowid=1
DEBUG: fetched: [(6,)]
DEBUG: UPDATE state_info SET count = 6 WHERE rowid = 1
DEBUG: Path /Users/prihodad/Documents/projects/dvc2-example/.dvc/cache inode 259931721
DEBUG: INSERT OR REPLACE INTO state(inode, size, mtime, timestamp, md5) VALUES (259931721, "1408117", "1557652462000000000", "1557652524846561024", "")
DEBUG: PRAGMA user_version;
DEBUG: fetched: [(3,)]
DEBUG: CREATE TABLE IF NOT EXISTS state (inode INTEGER PRIMARY KEY, mtime TEXT NOT NULL, size TEXT NOT NULL, md5 TEXT NOT NULL, timestamp TEXT NOT NULL)
DEBUG: CREATE TABLE IF NOT EXISTS state_info (count INTEGER)
DEBUG: CREATE TABLE IF NOT EXISTS link_state (path TEXT PRIMARY KEY, inode INTEGER NOT NULL, mtime TEXT NOT NULL)
DEBUG: INSERT OR IGNORE INTO state_info (count) SELECT 0 WHERE NOT EXISTS (SELECT * FROM state_info)
DEBUG: PRAGMA user_version = 3;
DEBUG: Removing output 'mibig_json_1.4.tar.gz' of 'mibig_json_1.4.tar.gz.dvc'.
DEBUG: Removing 'mibig_json_1.4.tar.gz'
Importing 'https://mibig.secondarymetabolites.org/mibig_json_1.4.tar.gz' -> '/Users/prihodad/Documents/projects/dvc2-example/example/mibig_json_1.4.tar.gz'
DEBUG: Computed stage 'mibig_json_1.4.tar.gz.dvc' md5: '9d1b61169e8c0795fcf31de916db584b'
DEBUG: Downloading 'https://mibig.secondarymetabolites.org/mibig_json_1.4.tar.gz' to '/Users/prihodad/Documents/projects/dvc2-example/example/mibig_json_1.4.tar.gz'
[##############################] 100% mibig_json_1.4.tar.gz

DEBUG: SELECT count from state_info WHERE rowid=1

DEBUG: fetched: [(6,)]

DEBUG: UPDATE state_info SET count = 6 WHERE rowid = 1

DEBUG: Path /Users/prihodad/Documents/projects/dvc2-example/.dvc/cache inode 259931721

DEBUG: INSERT OR REPLACE INTO state(inode, size, mtime, timestamp, md5) VALUES (259931721, "1408117", "1557652462000000000", "1557652527775110912", "")

ERROR: unexpected error
------------------------------------------------------------
Traceback (most recent call last):
File "/Users/prihodad/anaconda3/lib/python3.6/site-packages/dvc/main.py", line 38, in main
ret = cmd.run_cmd()
File "/Users/prihodad/anaconda3/lib/python3.6/site-packages/dvc/command/base.py", line 60, in run_cmd
return self.run()
File "/Users/prihodad/anaconda3/lib/python3.6/site-packages/dvc/command/imp.py", line 23, in run
self.args.url, out, self.args.resume, fname=self.args.file
File "/Users/prihodad/anaconda3/lib/python3.6/site-packages/dvc/repo/scm_context.py", line 4, in run
result = method(repo, *args, **kw)
File "/Users/prihodad/anaconda3/lib/python3.6/site-packages/dvc/repo/imp.py", line 19, in imp
stage.run(resume=resume)
File "/Users/prihodad/anaconda3/lib/python3.6/site-packages/dvc/stage.py", line 834, in run
self.save()
File "/Users/prihodad/anaconda3/lib/python3.6/site-packages/dvc/stage.py", line 689, in save
dep.save()
File "/Users/prihodad/anaconda3/lib/python3.6/site-packages/dvc/output/base.py", line 211, in save
self.info = self.remote.save_info(self.path_info)
File "/Users/prihodad/anaconda3/lib/python3.6/site-packages/dvc/remote/base.py", line 283, in save_info
assert path_info.scheme == self.scheme
AssertionError
------------------------------------------------------------

Having any troubles?. Hit us up at https://dvc.org/support, we are always happy to help!

# Fixed code
def download(
    self,
    from_infos,
    to_infos,
    no_progress_bar=False,
    names=None,
    resume=False,
):
    names = self._verify_path_args(to_infos, from_infos, names)

    for to_info, from_info, name in zip(to_infos, from_infos, names):
        if from_info.scheme != self.scheme:
            raise NotImplementedError

        if to_info.scheme != "local":
            raise NotImplementedError

        msg = "Downloading '{}' to '{}'".format(from_info.path, to_info.path)
        logger.debug(msg)

        if not name:
            name = os.path.basename(to_info.path)

        makedirs(os.path.dirname(to_info.path), exist_ok=True)

        total = self._content_length(from_info.path)

        if no_progress_bar or not total:
            cb = None
        else:
            cb = ProgressBarCallback(name, total)

        try:
            self._download_to(from_info.path, to_info.path, callback=cb, resume=resume)

        except Exception:
            msg = "failed to download '{}'".format(from_info.path)
            logger.exception(msg)
            continue

        if not no_progress_bar:
            progress.finish_target(name)