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

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

Closed
1 task done
SilasK opened this issue Nov 8, 2021 · 11 comments
Closed
1 task done

Comments

@SilasK
Copy link

SilasK commented Nov 8, 2021

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
@asl
Copy link
Member

asl commented Nov 8, 2021

Thanks, dup of #863

@asl asl closed this as completed Nov 8, 2021
@asl asl added the duplicate label Nov 8, 2021
@Anushka622001
Copy link

resolve this error

@MatthiasWilm
Copy link

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

@wesleyfranks
Copy link

MattiasWilm your response fixed my issue with AttributeError, thanks.

@asl
Copy link
Member

asl commented Apr 30, 2022

This issue was fixed in SPAdes 3.15.4

@frunzacatalin76
Copy link

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 :)

@asl
Copy link
Member

asl commented Jun 16, 2022

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

@CalJMarsh
Copy link

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.

@asl
Copy link
Member

asl commented Jul 13, 2022

@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

@dhiru16
Copy link

dhiru16 commented Oct 5, 2022

I got the same error but am using the spades 3.15.5

@asl
Copy link
Member

asl commented Oct 5, 2022

@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
Projects
None yet
Development

No branches or pull requests

8 participants