peewee.OperationalError: unable to open database file

the whole error info with the command “python3 -m prodigy dataset my_dataset ‘a data set’” is as following:

===========================================================

f018984afbb1:prodigy cdu794$ python3 -m prodigy dataset my_set “a data set”
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3768, in _create_connection
return self._connect(self.database, **self.connect_kwargs)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 4023, in _connect
conn = sqlite3.connect(database, **kwargs)
sqlite3.OperationalError: unable to open database file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3828, in execute_sql
cursor = self.get_cursor()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3774, in get_cursor
return self.get_conn().cursor()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3763, in get_conn
self.connect()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3738, in connect
self._local.conn = self._create_connection()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3768, in _create_connection
return self._connect(self.database, **self.connect_kwargs)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3656, in exit
reraise(new_type, new_type(*exc_args), traceback)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 135, in reraise
raise value.with_traceback(tb)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3768, in _create_connection
return self._connect(self.database, **self.connect_kwargs)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 4023, in _connect
conn = sqlite3.connect(database, **kwargs)
peewee.OperationalError: unable to open database file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prodigy/main.py”, line 372, in
plac.call(commands[command], arglist=args, eager=False)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/plac_core.py”, line 328, in call
cmd, result = parser.consume(arglist)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/plac_core.py”, line 207, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prodigy/main.py”, line 46, in dataset
if set_id in DB:
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prodigy/components/db.py”, line 177, in contains
has_ds = bool(Dataset.get(Dataset.name == name))
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 4988, in get
return sq.get()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3220, in get
return next(clone.execute())
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3274, in execute
self._qr = ResultWrapper(model_class, self._execute(), query_meta)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 2939, in _execute
return self.database.execute_sql(sql, params, self.require_commit)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3837, in execute_sql
self.commit()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3656, in exit
reraise(new_type, new_type(*exc_args), traceback)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 135, in reraise
raise value.with_traceback(tb)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3828, in execute_sql
cursor = self.get_cursor()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3774, in get_cursor
return self.get_conn().cursor()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3763, in get_conn
self.connect()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3738, in connect
self._local.conn = self._create_connection()
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3768, in _create_connection
return self._connect(self.database, **self.connect_kwargs)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3656, in exit
reraise(new_type, new_type(*exc_args), traceback)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 135, in reraise
raise value.with_traceback(tb)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 3768, in _create_connection
return self._connect(self.database, **self.connect_kwargs)
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/peewee.py”, line 4023, in _connect
conn = sqlite3.connect(database, **kwargs)
peewee.OperationalError: unable to open database file

So how can i modify my prodigy.json? i just copy paste from the help docs as following without any modification.

======================================================

{
    "theme": "basic",
    "custom_theme": {},
    "batch_size": 10,
    "port": 8080,
    "host": "localhost",
    "cors": true,
    "db": "sqlite",
    "db_settings": {},
    "api_keys": {},
    "validate": true,
    "auto_create": true,
    "auto_exclude_current": true,
    "instant_submit": false,
    "feed_overlap": true,
    "show_stats": false,
    "hide_meta": false,
    "show_flag": false,
    "instructions": false,
    "swipe": false,
    "split_sents_threshold": false,
    "diff_style": "words",
    "html_template": false,
    "global_css": null,
    "javascript": null,
    "writing_dir": "ltr",
    "hide_true_newline_tokens": false,
    "ner_manual_require_click": false,
    "ner_manual_label_style": "list",
    "choice_style": "single",
    "choice_auto_accept": false,
    "darken_image": 0,
    "show_bounding_box_center": false,
    "preview_bounding_boxes": false,
    "shade_bounding_boxes": false
}

@weijia_sun Ah, sorry – I was replying to the first tweet in the thread. I didn’t see that you had also posted something else in the meantime. Your error looks quite different and most likely isn’t related, so I moved it to a new topic.

What’s going on here is that Prodigy can’t create a new SQLite database and/or open the database file. This is likely not a problem in Prodigy itself. Here are some tips to debug this:

  • Double-check that SQLite is installed and available. It should be included with Python, but depending on your build and platform, maybe it’s not.
  • Double-check that a .prodigy directory was created in your user home directory and is writable (that’s what should happen by default). Alternatively, you can use the PRODIGY_HOME environment variable to point it to a writable directory Prodigy can create the prodigy.json and SQLite database file in.

the issue has been fixed up.
i use “sudo” to execute the dataset creating command as following:
$sudo python3 -m prodigy dataset my_dataset “a new dataset”