galojzybarbanach
galojzybarbanach

Reputation: 31

Snakemake tutorial error: "AttributeError: 'str' object has no attribute 'name' "

When I try running the first command (snakemake -np mapped_reads/A.bam) from the Step 1 of Snakemake tutorial (https://snakemake.readthedocs.io/en/stable/tutorial/basics.html) I get the following error:

snakemake -np mapped_reads/A.bam
Building DAG of jobs...
Traceback (most recent call last):
  File "/home/jeremi1504/mambaforge/envs/snakemake-tutorial/lib/python3.8/site-packages/snakemake/__init__.py", line 701, in snakemake
    success = workflow.execute(
  File "/home/jeremi1504/mambaforge/envs/snakemake-tutorial/lib/python3.8/site-packages/snakemake/workflow.py", line 1066, in execute
    logger.run_info("\n".join(dag.stats()))
  File "/home/jeremi1504/mambaforge/envs/snakemake-tutorial/lib/python3.8/site-packages/snakemake/dag.py", line 2191, in stats
    yield tabulate(rows, headers="keys")
  File "/home/jeremi1504/mambaforge/envs/snakemake-tutorial/lib/python3.8/site-packages/tabulate/__init__.py", line 2048, in tabulate
    list_of_lists, headers = _normalize_tabular_data(
  File "/home/jeremi1504/mambaforge/envs/snakemake-tutorial/lib/python3.8/site-packages/tabulate/__init__.py", line 1471, in _normalize_tabular_data
    rows = list(map(lambda r: r if _is_separating_line(r) else list(r), rows))
  File "/home/jeremi1504/mambaforge/envs/snakemake-tutorial/lib/python3.8/site-packages/tabulate/__init__.py", line 1471, in <lambda>
    rows = list(map(lambda r: r if _is_separating_line(r) else list(r), rows))
  File "/home/jeremi1504/mambaforge/envs/snakemake-tutorial/lib/python3.8/site-packages/tabulate/__init__.py", line 107, in _is_separating_line
    (len(row) >= 1 and row[0] == SEPARATING_LINE)
  File "/home/jeremi1504/mambaforge/envs/snakemake-tutorial/lib/python3.8/site-packages/snakemake/rules.py", line 1138, in __eq__
    return self.name == other.name and self.output == other.output
AttributeError: 'str' object has no attribute 'name'

I followed all the commands from the set-up section (https://snakemake.readthedocs.io/en/stable/tutorial/setup.html) and everything seems to be installed properly. The required environment is active and I had no problems activating it. I also build my snakefile according to the instructions.

What can be the source of the problem? I understand what causes the usual 'AttributeError' but I do not know why it occurs in a tutorial that is supposed to work without any modifications from the user.

How can I overcome this error? Is it a matter of installing additional dependencies? If so, which ones? Or is the tutorial broken/outdated/malformed?

Upvotes: 1

Views: 2280

Answers (1)

dariober
dariober

Reputation: 9062

You hit this bug https://github.com/snakemake/snakemake/issues/1899

Try upgrading snakemake to the latest version or, if can't, downgrade tabulate to 0.8.

Upvotes: 3

Related Questions