cblaster icon indicating copy to clipboard operation
cblaster copied to clipboard

makedb always results in 'sqlite3.OperationalError: database is locked'

Open jjsanchezgil opened this issue 2 years ago • 2 comments

Hi,

I have been trying to create a local database but sqlite3 keeps showing this error.

$ cblaster makedb -n test genomic.gff

Importing genomicsqlite failed, falling back to SQLite3 [12:06:13] INFO - Starting makedb module [12:06:13] INFO - Initialising cblaster SQLite3 database to test.sqlite3 Traceback (most recent call last): File "/opt/conda/anaconda3/envs/cblaster-env/bin/cblaster", line 10, in sys.exit(main()) File "/opt/conda/anaconda3/envs/cblaster-env/lib/python3.8/site-packages/cblaster/main.py", line 422, in main database.makedb( File "/opt/conda/anaconda3/envs/cblaster-env/lib/python3.8/site-packages/cblaster/database.py", line 180, in makedb init_sqlite_db(sqlite_path, force=force) File "/opt/conda/anaconda3/envs/cblaster-env/lib/python3.8/site-packages/cblaster/database.py", line 39, in init_sqlite_db con.executescript(sql.SCHEMA) sqlite3.OperationalError: database is locked

When I install genomicsqlite, there is still a different error (probably with the same origin)

$ cblaster makedb -f -n test genomic.gff

[12:22:06] INFO - Starting makedb module [12:22:06] INFO - Pre-existing files found, overwriting [12:22:06] INFO - Overwriting pre-existing file at test.sqlite3 Traceback (most recent call last): File "/opt/conda/anaconda3/envs/cblaster-env/bin/cblaster", line 10, in sys.exit(main()) ^^^^^^ File "/opt/conda/anaconda3/envs/cblaster-env/lib/python3.11/site-packages/cblaster/main.py", line 423, in main database.makedb( File "/opt/conda/anaconda3/envs/cblaster-env/lib/python3.11/site-packages/cblaster/database.py", line 185, in makedb init_sqlite_db(sqlite_path, force=force) File "/opt/conda/anaconda3/envs/cblaster-env/lib/python3.11/site-packages/cblaster/database.py", line 43, in init_sqlite_db with SQLITE.connect(str(path)) as con: ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/juanjo/.local/lib/python3.11/site-packages/genomicsqlite/init.py", line 73, in connect conn = sqlite3.connect(uri, uri=True, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: unable to open database file

In my folder I have 3 files: genomic.fasta, genomic.gff, and genomic.gbff, but it doesn't matter if you try to build a database with only one file, like in this case, or with thousands, and either from gff or gbff. I tried installing cblaster from conda and with pip, but still the same error. What could be the source of the problem? Thanks

jjsanchezgil avatar Jan 26 '23 11:01 jjsanchezgil

Not sure what is happening unfortunately, I haven't run into this and can't reproduce it. Usually this error would come from something also interacting with the SQLite database file at the same time (e.g. via a DB browser/through the terminal). Maybe you have some rogue process in the background causing it to lock (https://stackoverflow.com/a/3481134)?

gamcil avatar Feb 09 '23 02:02 gamcil

Hi, any chance someone solved this issue? I'm getting the same error regarding sqlite being unable to open database file.

mcn3159 avatar Sep 18 '23 03:09 mcn3159