We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`retriever download` command throwing error.
After running `retriever download iris`, I am getting this error : 
![image](https://files.gitter.im/606462c26da037398478bdfb/LB3L/image.png)

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `retriever/lib/install.py`
Content:
```
1 import os
2 from collections import OrderedDict
3 
4 from retriever.engines import choose_engine
5 from retriever.lib.defaults import DATA_DIR, SCRIPT_WRITE_PATH, PROVENANCE_DIR
6 from retriever.lib.scripts import SCRIPT_LIST, name_matches
7 from retriever.lib.repository import check_for_updates
8 from retriever.lib.provenance import install_committed
9 
10 
11 def _install(args, use_cache, debug):
12     """Install datasets for retriever."""
13     engine = choose_engine(args)
14     engine.use_cache = use_cache
15 
16     if args['dataset'].endswith('.zip') or args['hash_value']:
17         path_to_archive = args['dataset']
18         if args['hash_value']:
19             path_to_archive = os.path.join(
20                 PROVENANCE_DIR, args['dataset'],
21                 '{}-{}.zip'.format(args['dataset'], args['hash_value']))
22         if not os.path.exists(path_to_archive):
23             print('The committed file does not exist.')
24         engine = install_committed(path_to_archive,
25                                    engine,
26                                    force=args.get('force', False))
27         return engine
28     script_list = SCRIPT_LIST()
29     if not (script_list or os.listdir(SCRIPT_WRITE_PATH)):
30         check_for_updates()
31         script_list = SCRIPT_LIST()
32     data_sets_scripts = name_matches(script_list, args['dataset'])
33     if data_sets_scripts:
34         for data_sets_script in data_sets_scripts:
35             print("=> Installing", data_sets_script.name)
36             try:
37                 if engine.name == "HDF5":
38                     sqlite_opts = {
39                         'command': 'install',
40                         'dataset': data_sets_script,
41                         'engine': 'sqlite',
42                         'file': (args["file"].split("."))[0] + ".db",
43                         'table_name': args["table_name"],
44                         'data_dir': args["data_dir"]
45                     }
46                     sqlite_engine = choose_engine(sqlite_opts)
47                     data_sets_script.download(sqlite_engine, debug=debug)
48                     data_sets_script.engine.final_cleanup()
49                 engine.script_table_registry = OrderedDict()
50                 data_sets_script.download(engine, debug=debug)
51                 data_sets_script.engine.final_cleanup()
52             except Exception as e:
53                 print(e)
54                 if debug:
55                     raise
56     else:
57         message = "Run retriever.datasets() to list the currently available " \
58                   "datasets."
59         raise ValueError(message)
60     return engine
61 
62 
63 def install_csv(dataset,
64                 table_name='{db}_{table}.csv',
65                 data_dir=DATA_DIR,
66                 debug=False,
67                 use_cache=True,
68                 force=False,
69                 hash_value=None):
70     """Install datasets into csv."""
71     args = {
72         'command': 'install',
73         'dataset': dataset,
74         'engine': 'csv',
75         'table_name': table_name,
76         'data_dir': data_dir,
77         'force': force,
78         'hash_value': hash_value
79     }
80     return _install(args, use_cache, debug)
81 
82 
83 def install_mysql(dataset,
84                   user='root',
85                   password='',
86                   host='localhost',
87                   port=3306,
88                   database_name='{db}',
89                   table_name='{db}.{table}',
90                   debug=False,
91                   use_cache=True,
92                   force=False,
93                   hash_value=None):
94     """Install datasets into mysql."""
95     args = {
96         'command': 'install',
97         'database_name': database_name,
98         'engine': 'mysql',
99         'dataset': dataset,
100         'host': host,
101         'port': port,
102         'password': password,
103         'table_name': table_name,
104         'user': user,
105         'force': force,
106         'hash_value': hash_value
107     }
108     return _install(args, use_cache, debug)
109 
110 
111 def install_postgres(dataset,
112                      user='postgres',
113                      password='',
114                      host='localhost',
115                      port=5432,
116                      database='postgres',
117                      database_name='{db}',
118                      table_name='{db}.{table}',
119                      bbox=[],
120                      debug=False,
121                      use_cache=True,
122                      force=False,
123                      hash_value=None):
124     """Install datasets into postgres."""
125     args = {
126         'command': 'install',
127         'database': database,
128         'database_name': database_name,
129         'engine': 'postgres',
130         'dataset': dataset,
131         'host': host,
132         'port': port,
133         'password': password,
134         'table_name': table_name,
135         'user': user,
136         'bbox': bbox,
137         'force': force,
138         'hash_value': hash_value
139     }
140     return _install(args, use_cache, debug)
141 
142 
143 def install_sqlite(dataset,
144                    file='sqlite.db',
145                    table_name='{db}_{table}',
146                    data_dir=DATA_DIR,
147                    debug=False,
148                    use_cache=True,
149                    force=False,
150                    hash_value=None):
151     """Install datasets into sqlite."""
152     args = {
153         'command': 'install',
154         'dataset': dataset,
155         'engine': 'sqlite',
156         'file': file,
157         'table_name': table_name,
158         'data_dir': data_dir,
159         'force': force,
160         'hash_value': hash_value
161     }
162     return _install(args, use_cache, debug)
163 
164 
165 def install_msaccess(dataset,
166                      file='access.mdb',
167                      table_name='[{db} {table}]',
168                      data_dir=DATA_DIR,
169                      debug=False,
170                      use_cache=True,
171                      force=False,
172                      hash_value=None):
173     """Install datasets into msaccess."""
174     args = {
175         'command': 'install',
176         'dataset': dataset,
177         'engine': 'msaccess',
178         'file': file,
179         'table_name': table_name,
180         'data_dir': data_dir,
181         'force': force,
182         'hash_value': hash_value
183     }
184     return _install(args, use_cache, debug)
185 
186 
187 def install_json(dataset,
188                  table_name='{db}_{table}.json',
189                  data_dir=DATA_DIR,
190                  debug=False,
191                  use_cache=True,
192                  pretty=False,
193                  force=False,
194                  hash_value=None):
195     """Install datasets into json."""
196     args = {
197         'command': 'install',
198         'dataset': dataset,
199         'engine': 'json',
200         'table_name': table_name,
201         'data_dir': data_dir,
202         'pretty': pretty,
203         'force': force,
204         'hash_value': hash_value
205     }
206     return _install(args, use_cache, debug)
207 
208 
209 def install_xml(dataset,
210                 table_name='{db}_{table}.xml',
211                 data_dir=DATA_DIR,
212                 debug=False,
213                 use_cache=True,
214                 force=False,
215                 hash_value=None):
216     """Install datasets into xml."""
217     args = {
218         'command': 'install',
219         'dataset': dataset,
220         'engine': 'xml',
221         'table_name': table_name,
222         'data_dir': data_dir,
223         'force': force,
224         'hash_value': hash_value
225     }
226     return _install(args, use_cache, debug)
227 
228 
229 def install_hdf5(dataset,
230                  file='hdf5.h5',
231                  table_name='{db}_{table}',
232                  data_dir=DATA_DIR,
233                  debug=False,
234                  use_cache=True,
235                  hash_value=None):
236     """Install datasets into hdf5."""
237     args = {
238         'command': 'install',
239         'dataset': dataset,
240         'engine': 'hdf5',
241         'file': file,
242         'table_name': table_name,
243         'data_dir': data_dir,
244         'hash_value': hash_value
245     }
246     return _install(args, use_cache, debug)
247
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/retriever/lib/install.py b/retriever/lib/install.py
--- a/retriever/lib/install.py
+++ b/retriever/lib/install.py
@@ -13,9 +13,9 @@
     engine = choose_engine(args)
     engine.use_cache = use_cache
 
-    if args['dataset'].endswith('.zip') or args['hash_value']:
+    if args['dataset'].endswith('.zip') or args.get('hash_value'):
         path_to_archive = args['dataset']
-        if args['hash_value']:
+        if args.get('hash_value'):
             path_to_archive = os.path.join(
                 PROVENANCE_DIR, args['dataset'],
                 '{}-{}.zip'.format(args['dataset'], args['hash_value']))

{"golden_diff": "diff --git a/retriever/lib/install.py b/retriever/lib/install.py\n--- a/retriever/lib/install.py\n+++ b/retriever/lib/install.py\n@@ -13,9 +13,9 @@\n     engine = choose_engine(args)\n     engine.use_cache = use_cache\n \n-    if args['dataset'].endswith('.zip') or args['hash_value']:\n+    if args['dataset'].endswith('.zip') or args.get('hash_value'):\n         path_to_archive = args['dataset']\n-        if args['hash_value']:\n+        if args.get('hash_value'):\n             path_to_archive = os.path.join(\n                 PROVENANCE_DIR, args['dataset'],\n                 '{}-{}.zip'.format(args['dataset'], args['hash_value']))\n", "issue": "`retriever download` command throwing error.\nAfter running `retriever download iris`, I am getting this error : \r\n![image](https://files.gitter.im/606462c26da037398478bdfb/LB3L/image.png)\n", "before_files": [{"content": "import os\nfrom collections import OrderedDict\n\nfrom retriever.engines import choose_engine\nfrom retriever.lib.defaults import DATA_DIR, SCRIPT_WRITE_PATH, PROVENANCE_DIR\nfrom retriever.lib.scripts import SCRIPT_LIST, name_matches\nfrom retriever.lib.repository import check_for_updates\nfrom retriever.lib.provenance import install_committed\n\n\ndef _install(args, use_cache, debug):\n    \"\"\"Install datasets for retriever.\"\"\"\n    engine = choose_engine(args)\n    engine.use_cache = use_cache\n\n    if args['dataset'].endswith('.zip') or args['hash_value']:\n        path_to_archive = args['dataset']\n        if args['hash_value']:\n            path_to_archive = os.path.join(\n                PROVENANCE_DIR, args['dataset'],\n                '{}-{}.zip'.format(args['dataset'], args['hash_value']))\n        if not os.path.exists(path_to_archive):\n            print('The committed file does not exist.')\n        engine = install_committed(path_to_archive,\n                                   engine,\n                                   force=args.get('force', False))\n        return engine\n    script_list = SCRIPT_LIST()\n    if not (script_list or os.listdir(SCRIPT_WRITE_PATH)):\n        check_for_updates()\n        script_list = SCRIPT_LIST()\n    data_sets_scripts = name_matches(script_list, args['dataset'])\n    if data_sets_scripts:\n        for data_sets_script in data_sets_scripts:\n            print(\"=> Installing\", data_sets_script.name)\n            try:\n                if engine.name == \"HDF5\":\n                    sqlite_opts = {\n                        'command': 'install',\n                        'dataset': data_sets_script,\n                        'engine': 'sqlite',\n                        'file': (args[\"file\"].split(\".\"))[0] + \".db\",\n                        'table_name': args[\"table_name\"],\n                        'data_dir': args[\"data_dir\"]\n                    }\n                    sqlite_engine = choose_engine(sqlite_opts)\n                    data_sets_script.download(sqlite_engine, debug=debug)\n                    data_sets_script.engine.final_cleanup()\n                engine.script_table_registry = OrderedDict()\n                data_sets_script.download(engine, debug=debug)\n                data_sets_script.engine.final_cleanup()\n            except Exception as e:\n                print(e)\n                if debug:\n                    raise\n    else:\n        message = \"Run retriever.datasets() to list the currently available \" \\\n                  \"datasets.\"\n        raise ValueError(message)\n    return engine\n\n\ndef install_csv(dataset,\n                table_name='{db}_{table}.csv',\n                data_dir=DATA_DIR,\n                debug=False,\n                use_cache=True,\n                force=False,\n                hash_value=None):\n    \"\"\"Install datasets into csv.\"\"\"\n    args = {\n        'command': 'install',\n        'dataset': dataset,\n        'engine': 'csv',\n        'table_name': table_name,\n        'data_dir': data_dir,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_mysql(dataset,\n                  user='root',\n                  password='',\n                  host='localhost',\n                  port=3306,\n                  database_name='{db}',\n                  table_name='{db}.{table}',\n                  debug=False,\n                  use_cache=True,\n                  force=False,\n                  hash_value=None):\n    \"\"\"Install datasets into mysql.\"\"\"\n    args = {\n        'command': 'install',\n        'database_name': database_name,\n        'engine': 'mysql',\n        'dataset': dataset,\n        'host': host,\n        'port': port,\n        'password': password,\n        'table_name': table_name,\n        'user': user,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_postgres(dataset,\n                     user='postgres',\n                     password='',\n                     host='localhost',\n                     port=5432,\n                     database='postgres',\n                     database_name='{db}',\n                     table_name='{db}.{table}',\n                     bbox=[],\n                     debug=False,\n                     use_cache=True,\n                     force=False,\n                     hash_value=None):\n    \"\"\"Install datasets into postgres.\"\"\"\n    args = {\n        'command': 'install',\n        'database': database,\n        'database_name': database_name,\n        'engine': 'postgres',\n        'dataset': dataset,\n        'host': host,\n        'port': port,\n        'password': password,\n        'table_name': table_name,\n        'user': user,\n        'bbox': bbox,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_sqlite(dataset,\n                   file='sqlite.db',\n                   table_name='{db}_{table}',\n                   data_dir=DATA_DIR,\n                   debug=False,\n                   use_cache=True,\n                   force=False,\n                   hash_value=None):\n    \"\"\"Install datasets into sqlite.\"\"\"\n    args = {\n        'command': 'install',\n        'dataset': dataset,\n        'engine': 'sqlite',\n        'file': file,\n        'table_name': table_name,\n        'data_dir': data_dir,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_msaccess(dataset,\n                     file='access.mdb',\n                     table_name='[{db} {table}]',\n                     data_dir=DATA_DIR,\n                     debug=False,\n                     use_cache=True,\n                     force=False,\n                     hash_value=None):\n    \"\"\"Install datasets into msaccess.\"\"\"\n    args = {\n        'command': 'install',\n        'dataset': dataset,\n        'engine': 'msaccess',\n        'file': file,\n        'table_name': table_name,\n        'data_dir': data_dir,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_json(dataset,\n                 table_name='{db}_{table}.json',\n                 data_dir=DATA_DIR,\n                 debug=False,\n                 use_cache=True,\n                 pretty=False,\n                 force=False,\n                 hash_value=None):\n    \"\"\"Install datasets into json.\"\"\"\n    args = {\n        'command': 'install',\n        'dataset': dataset,\n        'engine': 'json',\n        'table_name': table_name,\n        'data_dir': data_dir,\n        'pretty': pretty,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_xml(dataset,\n                table_name='{db}_{table}.xml',\n                data_dir=DATA_DIR,\n                debug=False,\n                use_cache=True,\n                force=False,\n                hash_value=None):\n    \"\"\"Install datasets into xml.\"\"\"\n    args = {\n        'command': 'install',\n        'dataset': dataset,\n        'engine': 'xml',\n        'table_name': table_name,\n        'data_dir': data_dir,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_hdf5(dataset,\n                 file='hdf5.h5',\n                 table_name='{db}_{table}',\n                 data_dir=DATA_DIR,\n                 debug=False,\n                 use_cache=True,\n                 hash_value=None):\n    \"\"\"Install datasets into hdf5.\"\"\"\n    args = {\n        'command': 'install',\n        'dataset': dataset,\n        'engine': 'hdf5',\n        'file': file,\n        'table_name': table_name,\n        'data_dir': data_dir,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n", "path": "retriever/lib/install.py"}], "after_files": [{"content": "import os\nfrom collections import OrderedDict\n\nfrom retriever.engines import choose_engine\nfrom retriever.lib.defaults import DATA_DIR, SCRIPT_WRITE_PATH, PROVENANCE_DIR\nfrom retriever.lib.scripts import SCRIPT_LIST, name_matches\nfrom retriever.lib.repository import check_for_updates\nfrom retriever.lib.provenance import install_committed\n\n\ndef _install(args, use_cache, debug):\n    \"\"\"Install datasets for retriever.\"\"\"\n    engine = choose_engine(args)\n    engine.use_cache = use_cache\n\n    if args['dataset'].endswith('.zip') or args.get('hash_value'):\n        path_to_archive = args['dataset']\n        if args.get('hash_value'):\n            path_to_archive = os.path.join(\n                PROVENANCE_DIR, args['dataset'],\n                '{}-{}.zip'.format(args['dataset'], args['hash_value']))\n        if not os.path.exists(path_to_archive):\n            print('The committed file does not exist.')\n        engine = install_committed(path_to_archive,\n                                   engine,\n                                   force=args.get('force', False))\n        return engine\n    script_list = SCRIPT_LIST()\n    if not (script_list or os.listdir(SCRIPT_WRITE_PATH)):\n        check_for_updates()\n        script_list = SCRIPT_LIST()\n    data_sets_scripts = name_matches(script_list, args['dataset'])\n    if data_sets_scripts:\n        for data_sets_script in data_sets_scripts:\n            print(\"=> Installing\", data_sets_script.name)\n            try:\n                if engine.name == \"HDF5\":\n                    sqlite_opts = {\n                        'command': 'install',\n                        'dataset': data_sets_script,\n                        'engine': 'sqlite',\n                        'file': (args[\"file\"].split(\".\"))[0] + \".db\",\n                        'table_name': args[\"table_name\"],\n                        'data_dir': args[\"data_dir\"]\n                    }\n                    sqlite_engine = choose_engine(sqlite_opts)\n                    data_sets_script.download(sqlite_engine, debug=debug)\n                    data_sets_script.engine.final_cleanup()\n                engine.script_table_registry = OrderedDict()\n                data_sets_script.download(engine, debug=debug)\n                data_sets_script.engine.final_cleanup()\n            except Exception as e:\n                print(e)\n                if debug:\n                    raise\n    else:\n        message = \"Run retriever.datasets() to list the currently available \" \\\n                  \"datasets.\"\n        raise ValueError(message)\n    return engine\n\n\ndef install_csv(dataset,\n                table_name='{db}_{table}.csv',\n                data_dir=DATA_DIR,\n                debug=False,\n                use_cache=True,\n                force=False,\n                hash_value=None):\n    \"\"\"Install datasets into csv.\"\"\"\n    args = {\n        'command': 'install',\n        'dataset': dataset,\n        'engine': 'csv',\n        'table_name': table_name,\n        'data_dir': data_dir,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_mysql(dataset,\n                  user='root',\n                  password='',\n                  host='localhost',\n                  port=3306,\n                  database_name='{db}',\n                  table_name='{db}.{table}',\n                  debug=False,\n                  use_cache=True,\n                  force=False,\n                  hash_value=None):\n    \"\"\"Install datasets into mysql.\"\"\"\n    args = {\n        'command': 'install',\n        'database_name': database_name,\n        'engine': 'mysql',\n        'dataset': dataset,\n        'host': host,\n        'port': port,\n        'password': password,\n        'table_name': table_name,\n        'user': user,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_postgres(dataset,\n                     user='postgres',\n                     password='',\n                     host='localhost',\n                     port=5432,\n                     database='postgres',\n                     database_name='{db}',\n                     table_name='{db}.{table}',\n                     bbox=[],\n                     debug=False,\n                     use_cache=True,\n                     force=False,\n                     hash_value=None):\n    \"\"\"Install datasets into postgres.\"\"\"\n    args = {\n        'command': 'install',\n        'database': database,\n        'database_name': database_name,\n        'engine': 'postgres',\n        'dataset': dataset,\n        'host': host,\n        'port': port,\n        'password': password,\n        'table_name': table_name,\n        'user': user,\n        'bbox': bbox,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_sqlite(dataset,\n                   file='sqlite.db',\n                   table_name='{db}_{table}',\n                   data_dir=DATA_DIR,\n                   debug=False,\n                   use_cache=True,\n                   force=False,\n                   hash_value=None):\n    \"\"\"Install datasets into sqlite.\"\"\"\n    args = {\n        'command': 'install',\n        'dataset': dataset,\n        'engine': 'sqlite',\n        'file': file,\n        'table_name': table_name,\n        'data_dir': data_dir,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_msaccess(dataset,\n                     file='access.mdb',\n                     table_name='[{db} {table}]',\n                     data_dir=DATA_DIR,\n                     debug=False,\n                     use_cache=True,\n                     force=False,\n                     hash_value=None):\n    \"\"\"Install datasets into msaccess.\"\"\"\n    args = {\n        'command': 'install',\n        'dataset': dataset,\n        'engine': 'msaccess',\n        'file': file,\n        'table_name': table_name,\n        'data_dir': data_dir,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_json(dataset,\n                 table_name='{db}_{table}.json',\n                 data_dir=DATA_DIR,\n                 debug=False,\n                 use_cache=True,\n                 pretty=False,\n                 force=False,\n                 hash_value=None):\n    \"\"\"Install datasets into json.\"\"\"\n    args = {\n        'command': 'install',\n        'dataset': dataset,\n        'engine': 'json',\n        'table_name': table_name,\n        'data_dir': data_dir,\n        'pretty': pretty,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_xml(dataset,\n                table_name='{db}_{table}.xml',\n                data_dir=DATA_DIR,\n                debug=False,\n                use_cache=True,\n                force=False,\n                hash_value=None):\n    \"\"\"Install datasets into xml.\"\"\"\n    args = {\n        'command': 'install',\n        'dataset': dataset,\n        'engine': 'xml',\n        'table_name': table_name,\n        'data_dir': data_dir,\n        'force': force,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n\n\ndef install_hdf5(dataset,\n                 file='hdf5.h5',\n                 table_name='{db}_{table}',\n                 data_dir=DATA_DIR,\n                 debug=False,\n                 use_cache=True,\n                 hash_value=None):\n    \"\"\"Install datasets into hdf5.\"\"\"\n    args = {\n        'command': 'install',\n        'dataset': dataset,\n        'engine': 'hdf5',\n        'file': file,\n        'table_name': table_name,\n        'data_dir': data_dir,\n        'hash_value': hash_value\n    }\n    return _install(args, use_cache, debug)\n", "path": "retriever/lib/install.py"}]}