FOI-Bioinformatics / flextaxd

FlexTaxD (Flexible Taxonomy Databases) - Create, add, merge different taxonomy sources (QIIME, GTDB, NCBI and more) and create metagenomic databases (kraken2, ganon and more )
GNU General Public License v3.0
65 stars 8 forks source link

Cano not import name "BadGzipFile" #29

Closed alienzj closed 3 years ago

alienzj commented 3 years ago

Hi, FOI-bioinformatics team member,

I meet error when i run:

flextaxd-create -db gtdb_r95.sqlite3 -o taxonomy/ --genomes_path gtdb/release95/fastani/database/ -p 20 --verbose -
-logs build_kraken2.db.log --create --db_name gtdb_k2_db --dbprogram kraken2
2020-11-13 10:42:07,494 create_databases [INFO ]  FlexTaxD-create logging initiated!
2020-11-13 10:42:07,531 create_databases [INFO ]  Processing files; create kraken seq.map
2020-11-13 10:42:07,532 DatabaseConnection [INFO ]  gtdb_r95.sqlite3 opened successfully.
2020-11-13 10:42:07,652 ProcessDirectory [INFO ]  Number of genomes annotated in database 31910
2020-11-13 10:42:07,652 ProcessDirectory [INFO ]  Process genome path (gtdb/release95/fastani/database/)
2020-11-13 10:42:08,306 ProcessDirectory [INFO ]  Processed 31910 genomes
2020-11-13 10:42:08,341 create_databases [INFO ]  Loading module: CreateKrakenDatabase
Traceback (most recent call last):
File "/ldfssz1/ST_META/share/User/zhujie/.conda/envs/bioenv/bin/flextaxd-create", line 10, in <module>
sys.exit(main())
File "/ldfssz1/ST_META/share/User/zhujie/.conda/envs/bioenv3.7/lib/python3.7/site-packages/flextaxd/create_databases.py", line 195, in main
classifier = dynamic_import("modules", "CreateKrakenDatabase")
File "/ldfssz1/ST_META/share/User/zhujie/.conda/envs/bioenv3.7/lib/python3.7/site-packages/flextaxd/create_databases.py", line 42, in dynamic_import
module = import_module(".".join([abs_module_path,class_name]))
File "/ldfssz1/ST_META/share/User/zhujie/.conda/envs/bioenv3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/ldfssz1/ST_META/share/User/zhujie/.conda/envs/bioenv3.7/lib/python3.7/site-packages/flextaxd/modules/CreateKrakenDatabase.py", line 17, in <module>
from gzip import BadGzipFile
ImportError: cannot import name 'BadGzipFile' from 'gzip' (/ldfssz1/ST_META/share/User/zhujie/.conda/envs/bioenv3.7/lib/python3.7/gzip.py)
davve2 commented 3 years ago

Hi thanks for reporting this issue!

This seems to occur using python 3.7 for some reason! The problem should not occur using python 3.8 (I just tested the two options), I will look for a solution using python 3.7, in the meantime I suggest to upgrade your python version in your conda environment

conda install python=3.8

/David

davve2 commented 3 years ago

@alienzj I have implemented a solution and it will come with the next version (v0.3.5) until then please use python 3.8 or later!

alienzj commented 3 years ago

Thanks, I will try.