AttributeError: module 'collections' has no attribute 'Hashable' (conds ainstalaltion with py 10) · Issue #873 · ablab/spades · GitHub
Skip to content

AttributeError: module 'collections' has no attribute 'Hashable' (conds ainstalaltion with py 10) #873

Closed

Description

@SilasK

Description of bug

error reading yaml file pyyaml3 due to python 3.10 mist likely.

AttributeError: module 'collections' has no attribute 'Hashable'

spades.log

System information:
SPAdes version: 3.15.3
Python version: 3.10.0
OS: Linux-5.4.104+-x86_64-with-glibc2.27

Output dir: /content/WD/sample2/assembly
Mode: ONLY assembling (without read error correction)
Debug mode is turned OFF

Dataset parameters:
Metagenomic mode
Reads:
Traceback (most recent call last):
File "/content/databases/conda_envs/91fde30436cb83f9107a310d5f69819a/bin/spades.py", line 659, in
main(sys.argv)
File "/content/databases/conda_envs/91fde30436cb83f9107a310d5f69819a/bin/spades.py", line 599, in main
print_params(log, log_filename, command_line, args, cfg)
File "/content/databases/conda_envs/91fde30436cb83f9107a310d5f69819a/bin/spades.py", line 327, in print_params
print_used_values(cfg, log)
File "/content/databases/conda_envs/91fde30436cb83f9107a310d5f69819a/bin/spades.py", line 117, in print_used_values
dataset_data = pyyaml.load(open(cfg["dataset"].yaml_filename))
File "/content/databases/conda_envs/91fde30436cb83f9107a310d5f69819a/share/spades/pyyaml3/init.py", line 72, in load
return loader.get_single_data()
File "/content/databases/conda_envs/91fde30436cb83f9107a310d5f69819a/share/spades/pyyaml3/constructor.py", line 37, in get_single_data
return self.construct_document(node)
File "/content/databases/conda_envs/91fde30436cb83f9107a310d5f69819a/share/spades/pyyaml3/constructor.py", line 46, in construct_document
for dummy in generator:
File "/content/databases/conda_envs/91fde30436cb83f9107a310d5f69819a/share/spades/pyyaml3/constructor.py", line 398, in construct_yaml_map
value = self.construct_mapping(node)
File "/content/databases/conda_envs/91fde30436cb83f9107a310d5f69819a/share/spades/pyyaml3/constructor.py", line 204, in construct_mapping
return super().construct_mapping(node, deep=deep)
File "/content/databases/conda_envs/91fde30436cb83f9107a310d5f69819a/share/spades/pyyaml3/constructor.py", line 126, in construct_mapping
if not isinstance(key, collections.Hashable):
AttributeError: module 'collections' has no attribute 'Hashable'

params.txt

unimportant

SPAdes version

3.15.3

Operating System

google colab

Python Version

3.10

Method of SPAdes installation

mamba

No errors reported in spades.log

  • Yes

Activity

  1. asl commented on Nov 8, 2021

    @asl
    Member

    Thanks, dup of #863

  2. Anushka622001 commented on Jan 8, 2022

    @Anushka622001

    resolve this error

  3. MatthiasWilm commented on Jan 12, 2022

    @MatthiasWilm

    I am a novel user of Spades. I solved the error by modifying a python script:
    Operation Environment
    SPAdes version: 3.15.3
    Python version: 3.10.1
    OS: macOS-12.1-x86_64-i386-64bit

    Edited file: ... /share/spades/pyyaml3/constructor.py
    Line: line 126
    Code was: if not isinstance(key, collections.Hashable):

    Code is: if not isinstance(key, collections.abc.Hashable):

    Reference Source:
    https://docs.python.org/3/library/collections.abc.html
    "New in version 3.3: Formerly, this module was part of the collections module.
    ...
    This module provides abstract base classes that can be used to test whether a class provides a particular interface; for example, whether it is hashable or whether it is a mapping."

  4. wesleyfranks commented on Apr 30, 2022

    @wesleyfranks

    MattiasWilm your response fixed my issue with AttributeError, thanks.

  5. asl commented on Apr 30, 2022

    @asl
    Member

    This issue was fixed in SPAdes 3.15.4

  6. frunzacatalin76 commented on Jun 16, 2022

    @frunzacatalin76

    I am a novel user of Spades. I solved the error by modifying a python script: Operation Environment SPAdes version: 3.15.3 Python version: 3.10.1 OS: macOS-12.1-x86_64-i386-64bit

    Edited file: ... /share/spades/pyyaml3/constructor.py Line: line 126 Code was: if not isinstance(key, collections.Hashable):

    Code is: if not isinstance(key, collections.abc.Hashable):

    Reference Source: https://docs.python.org/3/library/collections.abc.html "New in version 3.3: Formerly, this module was part of the collections module. ... This module provides abstract base classes that can be used to test whether a class provides a particular interface; for example, whether it is hashable or whether it is a mapping."

    I love you :)

  7. asl commented on Jun 16, 2022

    @asl
    Member

    No need to modify anything. The fix is included into the latest SPAdes 3.15.4 release

  8. CalJMarsh commented on Jul 13, 2022

    @CalJMarsh

    Hi asl,
    I am trying to use spades on mac, installing with bioconda. The latest SPAdes version available for mac osx is the 3.15.2 release. I am experiencing the same attribute error when I try to test my installation of SPAdes.
    Do you know if this fix will be available for Mac? the constructor.py script is different to the version listed in the fix above.

  9. asl commented on Jul 13, 2022

    @asl
    Member

    @CalJMarsh As it was stated above, the fix is included in SPAdes 3.15.4 release. On all platforms Mac included. Check SPAdes manual (https://cab.spbu.ru/files/release3.15.4/manual.html#sec2) for installation guide

  10. dhiru16 commented on Oct 5, 2022

    @dhiru16

    I got the same error but am using the spades 3.15.5

  11. asl commented on Oct 5, 2022

    @asl
    Member

    @dhiru16 Will you please open a new issue attaching all the files requested?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions