Running fauna downloads with Python 3.10, I get the following error:
$ python3 ../fauna/vdb/download.py --database vdb --virus flu --fasta_fields strain virus accession collection_date virus_inclusion_date region country division location passage_category originating_lab submitting_lab age gender --resolve_method split_passage --select locus:na lineage:seasonal_h3n2 --path data --fstem h3n2_na
Connected to the "vdb" database
Traceback (most recent call last):
File "/Users/jlhudd/projects/nextstrain/seasonal-flu/../fauna/vdb/download.py", line 348, in <module>
connVDB.download(**args.__dict__)
File "/Users/jlhudd/projects/nextstrain/seasonal-flu/../fauna/vdb/download.py", line 92, in download
self.connect_rethink(**kwargs)
File "/Users/jlhudd/projects/nextstrain/seasonal-flu/../fauna/vdb/download.py", line 76, in connect_rethink
self.rethink_io.check_table_exists(self.database, self.viruses_table)
File "/Users/jlhudd/projects/nextstrain/fauna/base/rethink_io.py", line 55, in check_table_exists
existing_tables = r.db(database).table_list().run()
File "/Users/jlhudd/projects/nextstrain/seasonal-flu/.snakemake/conda/c83f6854a929957f083866da157d184c/lib/python3.10/site-packages/rethinkdb/query.py", line 143, in db
return ast.DB(*args)
File "/Users/jlhudd/projects/nextstrain/seasonal-flu/.snakemake/conda/c83f6854a929957f083866da157d184c/lib/python3.10/site-packages/rethinkdb/ast.py", line 125, in __init__
self._args = [expr(e) for e in args]
File "/Users/jlhudd/projects/nextstrain/seasonal-flu/.snakemake/conda/c83f6854a929957f083866da157d184c/lib/python3.10/site-packages/rethinkdb/ast.py", line 125, in <listcomp>
self._args = [expr(e) for e in args]
File "/Users/jlhudd/projects/nextstrain/seasonal-flu/.snakemake/conda/c83f6854a929957f083866da157d184c/lib/python3.10/site-packages/rethinkdb/ast.py", line 87, in expr
elif isinstance(val, collections.Callable):
AttributeError: module 'collections' has no attribute 'Callable'
Run the command shown above with a Python 3.10 conda environment.
Possible solution
We could switch all references of collections.Callable to collections.abc.Callable or we could maintain backward compatibility with earlier Python versions by trying to import from the abc module first and falling back to the older path as shown in this example.
Current Behavior
Running fauna downloads with Python 3.10, I get the following error:
This happens because fauna references a deprecated path to the
Callable
class. This class was reorganized into an abstract base class module (abc
) back in Python 3.7 and backwards compatibility with this path was removed in Python 3.10.How to reproduce
Run the command shown above with a Python 3.10 conda environment.
Possible solution
We could switch all references of
collections.Callable
tocollections.abc.Callable
or we could maintain backward compatibility with earlier Python versions by trying to import from theabc
module first and falling back to the older path as shown in this example.We don't specify a minimum Python version for fauna, but we use Python 3.7 in our Docker image and we require at least 3.7 for Augur. It would be reasonable to switch to the new
abc
path without maintaining backward compatibility.