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

ImportError: cannot import name 'MutableSequence' from 'collections' #535

Open
Winter-Sno opened this issue Jan 21, 2024 · 2 comments
Open

Comments

@Winter-Sno
Copy link

Expected behaviour

I want to do onset detection in a classical music piece.
I expect the program to return an arraylist like [1,2,3,4,...] marking the onset timestamp of each note.

Actual behaviour

The program did nothing and an error like this occurred. (╥﹏╥...)

Traceback (most recent call last):
  File "D:\workspace\SRT_simulation\madmom_note_extract.py", line 1, in <module>
    import madmom
  File "D:\anaconda3\Lib\site-packages\madmom\__init__.py", line 24, in <module>
    from . import audio, evaluation, features, io, ml, models, processors, utils
  File "D:\anaconda3\Lib\site-packages\madmom\audio\__init__.py", line 27, in <module>
    from . import comb_filters, filters, signal, spectrogram, stft
  File "madmom\\audio\\comb_filters.pyx", line 15, in init madmom.audio.comb_filters
  File "D:\anaconda3\Lib\site-packages\madmom\processors.py", line 23, in <module>
    from collections import MutableSequence
ImportError: cannot import name 'MutableSequence' from 'collections' (D:\anaconda3\Lib\collections\__init__.py)

Steps needed to reproduce the behaviour

import madmom

filename = '01.Overture.flac'


def madmom_get_note_map(filename):
    proc = madmom.features.onsets.CNNOnsetProcessor()
    proc(filename)


if __name__ == '__main__':
    madmom_get_note_map(filename)

Information about installed software

python 3.11 (using anaconda)
madmom 0.16.1
numpy 1.24.3
scipy 1.11.1
cython 3.0.8
mido 1.3.2
packaging 23.1
@lucala
Copy link

lucala commented Jan 25, 2024

I had the same issue. The problem is with the python version we're using. As mentioned in this stackoverflow post the MutableSequence is now in collections.abc.

Changing line 23 in your D:\anaconda3\Lib\site-packages\madmom\processors.py file to from collections.abc import MutableSequence solves the issue.

@codeknowhow
Copy link

codeknowhow commented Feb 15, 2024

If you're on a mac the path is:

~/anaconda3/lib/python3.11/site-packages/madmom/processors.py

Just add the same change that @lucala provided above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants