# Buggy code
def __init__(self, stage, path, info=None, remote=None):
    super(DependencyHTTP, self).__init__(stage, path, info=info, remote=remote)
    if path.startswith("remote"):
        path = urljoin(self.remote.cache_dir, urlparse(path).path)

    self.path_info = HTTPPathInfo(url=self.url, path=path)


# 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 __init__(self, stage, path, info=None, remote=None):
    super(DependencyHTTP, self).__init__(stage, path, info=info, remote=remote)
    if path.startswith("remote"):
        path = urljoin(self.remote.cache_dir, urlparse(path).path)

    self.path_info = PathInfo(self.scheme, url=self.url, path=path)