Thanks! Looking forward to playing with this update! (our 2020.2 env broke during a server migration, as good an excuse to update as ever!)
I’m running QIIME2 in a jupyter notebook. I was having some issues with two modules specifically on import - seems to be a Unicode Decode Error with the citations.bib file?
from qiime2.plugins import feature_table
ValueError: There was a problem loading the BiBTex file:'/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/q2_feature_table/citations.bib'
from qiime2.plugins.metadata.visualizers import tabulate
ValueError: There was a problem loading the BiBTex file:'/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/q2_feature_table/citations.bib'
Interestingly, I get the same error with python functions calling q2:
stats_filenamelist = glob.glob('*stats.qza')
def read_dada_denoise_stats(fn):
table = q2.Artifact.load(fn)
df = table.view(q2.Metadata).to_dataframe()
df['seq_run'] = fn[0]
df['f_trunc'] = fn[fn.find('-')+1:fn.find('_')]
df['r_trunc'] = fn[fn.find('_')+1:fn.rfind('-')]
df.index.names = ['sampleid']
return df
stats_df = pd.concat([read_dada_denoise_stats(fn) for fn in stats_filenamelist])
print('Number of rows:', len(stats_df), '\nUnique sequence runs:', stats_df['seq_run'].unique())
error I’ve only copied the full error thrown after the python chunk and copied the valueError
for the import statements.
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/qiime2/core/cite.py in load(cls, path, package)
31 try:
---> 32 db = bp.load(fh, parser=parser)
33 except Exception as e:
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/bibtexparser/__init__.py in load(bibtex_file, parser)
70 parser = bparser.BibTexParser()
---> 71 return parser.parse_file(bibtex_file)
72
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/bibtexparser/bparser.py in parse_file(self, file, partial)
176 """
--> 177 return self.parse(file.read(), partial=partial)
178
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/encodings/ascii.py in decode(self, input, final)
25 def decode(self, input, final=False):
---> 26 return codecs.ascii_decode(input, self.errors)[0]
27
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 804: ordinal not in range(128)
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
<ipython-input-27-bc8ff275b40c> in <module>
10 return df
11
---> 12 stats_df = pd.concat([read_dada_denoise_stats(fn) for fn in stats_filenamelist])
13
14
<ipython-input-27-bc8ff275b40c> in <listcomp>(.0)
10 return df
11
---> 12 stats_df = pd.concat([read_dada_denoise_stats(fn) for fn in stats_filenamelist])
13
14
<ipython-input-27-bc8ff275b40c> in read_dada_denoise_stats(fn)
2
3 def read_dada_denoise_stats(fn):
----> 4 table = q2.Artifact.load(fn)
5 df = table.view(q2.Metadata).to_dataframe()
6 df['seq_run'] = fn[0]
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/qiime2/sdk/result.py in load(cls, filepath)
64 def load(cls, filepath):
65 """Factory for loading Artifacts and Visualizations."""
---> 66 archiver = archive.Archiver.load(filepath)
67
68 if Artifact._is_valid_type(archiver.type):
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/qiime2/core/archive/archiver.py in load(cls, filepath)
305 rec = archive.mount(path)
306
--> 307 return cls(path, Format(rec))
308
309 @classmethod
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/qiime2/core/archive/format/v1.py in __init__(self, archive_record)
27
28 def __init__(self, archive_record):
---> 29 super().__init__(archive_record)
30
31 self.provenance_dir = archive_record.root / self.PROVENANCE_DIR
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/qiime2/core/archive/format/v0.py in __init__(self, archive_record)
71 self.uuid = _uuid.UUID(uuid)
72 self.type = sdk.parse_type(type)
---> 73 self.format = sdk.parse_format(format)
74
75 self.path = path
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/qiime2/sdk/util.py in parse_format(format_str)
86 return None
87
---> 88 pm = qiime2.sdk.PluginManager()
89 try:
90 format_record = pm.formats[format_str]
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/qiime2/sdk/plugin_manager.py in __new__(cls, add_plugins)
52 if cls.__instance is None:
53 self = super().__new__(cls)
---> 54 self._init(add_plugins=add_plugins)
55 cls.__instance = self
56 else:
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/qiime2/sdk/plugin_manager.py in _init(self, add_plugins)
79 project_name = entry_point.dist.project_name
80 package = entry_point.module_name.split('.')[0]
---> 81 plugin = entry_point.load()
82
83 self.add_plugin(plugin, package, project_name)
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/pkg_resources/__init__.py in load(self, require, *args, **kwargs)
2470 if require:
2471 self.require(*args, **kwargs)
-> 2472 return self.resolve()
2473
2474 def resolve(self):
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/pkg_resources/__init__.py in resolve(self)
2476 Resolve the entry point from its module and attrs.
2477 """
-> 2478 module = __import__(self.module_name, fromlist=['__name__'], level=0)
2479 try:
2480 return functools.reduce(getattr, self.attrs, module)
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/q2_feature_table/plugin_setup.py in <module>
19 feature_table_merge_three_tables_example)
20
---> 21 citations = Citations.load('citations.bib', package='q2_feature_table')
22 plugin = Plugin(
23 name='feature-table',
/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/qiime2/core/cite.py in load(cls, path, package)
33 except Exception as e:
34 raise ValueError("There was a problem loading the BiBTex file:"
---> 35 "%r" % path) from e
36
37 entries = collections.OrderedDict()
ValueError: There was a problem loading the BiBTex file:'/export/data1/sw/tag_conda/envs/qiime2-2020.11/lib/python3.6/site-packages/q2_feature_table/citations.bib'
Thanks!