ImportError: Cannot import name 'read_metadata' from 'augur.io'

Job execution is stalling with the following error:

Traceback (most recent call last):
File “scripts/sanitize_metadata.py”, line 2, in
from augur.io import open_file, read_metadata
ImportError: cannot import name ‘read_metadata’ from ‘augur.io’ (/opt/miniconda3/envs/nextstrain/lib/python3.8/site-packages/augur/io.py)

Please advise. Gracias!

There appears to be something related to this glitch at:

But I’m not sure how to act on it :frowning:

Hi @jkhattra - could you let us know how you installed augur, what version you are using (you can find this via augur --version), and how you are running the snakefile (e.g. are you using snakemake or nextstrain build?). We’ll try to help debug this!

Hi James! I followed the Install Nextstrain with Conda and the SARS-CoV-2 Workflow documentation for installation. No customization. The Zika and SARS-CoV-2 global subsampling examples worked perfectly.
Version is augur 12.0.0. Am using snakemake.
I don’t know if the following is relevant, but the sanitize_metadata.py script has “import csv” in line 3, not tsv.

Thank you :pray:

Welcome @jkhattra! This error occurs because we added the read_metadata function to augur.io in version 12.1.0 and your local version of Augur is 12.0.0. There are a couple of different ways to fix the issue:

  1. Run your workflows with --use-conda. This flag will maintain a workflow-specific Conda environment and update it to the latest versions of Augur and other dependencies as we update the workflow. You can find a full example and explanation of this flag in the ncov workflow’s setup guide.

  2. Update your Conda environment’s Nextstrain installation. This will update your Conda environment to the latest version of Augur and other tools. You will need to remember to manually perform this update periodically.

  3. Install and run Nextstrain with the CLI and Docker. The Nextstrain CLI can run workflows with a Docker image that has all of the Nextstrain tools installed. The CLI also includes an update command that allows you to easily update these tools to their latest versions.

Do you want to try one of these approaches and let us know if it fixes the issue?

In addition to our regular updates to Nextstrain’s software tools, we also regularly update the ncov workflow. When we make changes to the workflow that could require you to update your software or make a change to your workflow configuration files, we note these breaking changes in our change log with a new versioned release. If you update to the latest version of the workflow and something breaks, there is a good chance we’ve made a new major release and you’ll need to check out the change log for details.

Thank you jlhudd :+1: Shall give your suggestions a try.