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

fauna downloads fail with Python 3.10 #121

Open
huddlej opened this issue Apr 19, 2022 · 0 comments
Open

fauna downloads fail with Python 3.10 #121

huddlej opened this issue Apr 19, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@huddlej
Copy link
Contributor

huddlej commented Apr 19, 2022

Current Behavior

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'

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 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.

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.

@huddlej huddlej added the bug Something isn't working label Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Backlog
Development

No branches or pull requests

1 participant