Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jjsanchezgil opened this issue Jan 26, 2023 · 2 comments

Comments

@jjsanchezgil
Copy link

jjsanchezgil commented Jan 26, 2023

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

@gamcil
Copy link
Owner

gamcil commented Feb 9, 2023

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)?

@mcn3159
Copy link

mcn3159 commented Sep 18, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants