tleonardi / nanocompore

RNA modifications detection from Nanopore dRNA-Seq data
https://nanocompore.rna.rocks
GNU General Public License v3.0
77 stars 12 forks source link

db type is dbm.gnu, but the module is not available #224

Open villegmb opened 7 months ago

villegmb commented 7 months ago

Hello, I am following your instructions and I get this error:

2023-11-15 15:55:54.103 | INFO | nanocompore.SampCompDB:init:55 - Loading SampCompDB 2023-11-15 15:55:54.108 | ERROR | nanocompore.common:init:22 - The result database cannot be opened

error Traceback (most recent call last) ~/miniconda3/envs/nanocompore/lib/python3.7/site-packages/nanocompore/SampCompDB.py in init(self, db_fn, fasta_fn, bed_fn, run_type) 58 try: ---> 59 with shelve.open(db_fn, flag='r') as db: 60 # Try to get metadata from db

~/miniconda3/envs/nanocompore/lib/python3.7/shelve.py in open(filename, flag, protocol, writeback) 242 --> 243 return DbfilenameShelf(filename, flag, protocol, writeback)

~/miniconda3/envs/nanocompore/lib/python3.7/shelve.py in init(self, filename, flag, protocol, writeback) 226 import dbm --> 227 Shelf.init(self, dbm.open(filename, flag), protocol, writeback) 228

~/miniconda3/envs/nanocompore/lib/python3.7/dbm/init.py in open(file, flag, mode) 90 raise error[0]("db type is {0}, but the module is not " ---> 91 "available".format(result)) 92 else:

error: db type is dbm.gnu, but the module is not available

During handling of the above exception, another exception occurred:

NanocomporeError Traceback (most recent call last) /tmp/ipykernel_83020/1373531596.py in 2 db = SampCompDB ( 3 db_fn = "/ibex/scratch/projects/c2078/Heat_stress_analysis/final_result_nanocompore/final_final_results/outSampComp.db", ----> 4 fasta_fn = "/ibex/scratch/projects/c2078/Villegmb/20230913_P4U2_2/Ahem_transcript_rename.fasta") 5 6 # Print general metadata information

~/miniconda3/envs/nanocompore/lib/python3.7/site-packages/nanocompore/SampCompDB.py in init(self, db_fn, fasta_fn, bed_fn, run_type) 75 return None 76 except dbm_error: ---> 77 raise NanocomporeError("The result database cannot be opened") 78 79 # Save db prefix and db path

NanocomporeError: The result database cannot be opened

villegmb commented 7 months ago

Someone comented in this blog https://community.anaconda.cloud/t/how-to-get-gdbm-module/35785/5

The cause of the error is unknown, but “_gdbm.cpython-39-x86_64-linux-gnu.so”, which should exist under “/lib/python3.9/lib-dynload/”, does not exist. .

If another version of the corresponding library exists, copying it to the above directory will solve the problem.

But I am not able to solve it this way. What other alternatives do you recommend to open the database?

lmulroney commented 7 months ago

Hi @villegmb,

Just for a little more context, can you share the command you were trying to do to open the database?

Thanks, Logan

villegmb commented 7 months ago

Hello. I am following this https://nanocompore.rna.rocks/demo/SampCompDB_usage/

> from nanocompore.SampCompDB import SampCompDB, help
> # Load database
> db = SampCompDB (
>     db_fn = "/ibex/scratch/projects/c2078/Heat_stress_analysis/final_result_nanocompore/final_final_results/outSampComp.db",
>     fasta_fn = "/ibex/scratch/projects/c2078/Villegmb/20230913_P4U2_2/Ahem_transcript_rename.fasta")
> 
> # Print general metadata information
> print (db)
lmulroney commented 7 months ago

Hi @villegmb,

Just a few more quick questions, and some possible solutions assuming some things about your setup.

Was the db generated on a linux, windows, or macOs machine? Are you trying to access the db on a windows, linux, or macOs machine? When you installed Nanocompore, did you install it in a clean virtual environment?

If you didn't install Nanocompore in a clean virtual environment, I recommend reinstalling Nanocompore in a new virtual environment and trying to open the database using the new virtual environment.

I've seen two possible solutions if you're on a linux machine. either install the libgdbm-dev library with sudo permissions: sudo apt-get install libgdbm-dev sudo yum install gdbm-devel

or try to reinstall it using pip (this might also work on Windows): pip install gdbm

If you're on a macOs you can try to install the gdbm library using: brew install gdbm

Alternatively, this stacked overflow post seems to suggest that the issues comes from the pycache folders in the source code. They had to rename some folders, update to a newer version of python, delete all the python caches, and restart PyCharm to resolve the issue. https://stackoverflow.com/questions/50998839/error-db-type-is-dbm-gnu-but-the-module-is-not-available-in-windows

Let me know if any of these possible solutions work for you.

Logan