urinieto / msaf

Music Structure Analysis Framework
MIT License
490 stars 78 forks source link

ImportError: cannot import name 'factorial' from 'scipy.misc' #113

Closed chymaera96 closed 2 years ago

chymaera96 commented 2 years ago

It appears that this is a compatibility issue with SciPy 1.3 where the 'factorial' has been moved to 'scipy.special'. Is there a new release coming up? The following is the error message:

ImportError Traceback (most recent call last) ~/anaconda3/lib/python3.8/site-packages/msaf/pymf/vol.py in 16 try: ---> 17 from scipy.misc.common import factorial 18 except:

ImportError: cannot import name 'factorial' from 'scipy.misc.common' (/home/aditya/anaconda3/lib/python3.8/site-packages/scipy/misc/common.py)

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)

in ----> 1 import msaf ~/anaconda3/lib/python3.8/site-packages/msaf/__init__.py in 23 from . import plotting 24 from . import utils ---> 25 from . import algorithms 26 from . import run 27 from .base import features_registry ~/anaconda3/lib/python3.8/site-packages/msaf/algorithms/__init__.py in 21 22 # Import all the algorithms in this folder ---> 23 [importlib.import_module(module_name) for module_name in module_names] 24 25 # Also init the __all__ var in case they want to use "*" to import all ~/anaconda3/lib/python3.8/site-packages/msaf/algorithms/__init__.py in (.0) 21 22 # Import all the algorithms in this folder ---> 23 [importlib.import_module(module_name) for module_name in module_names] 24 25 # Also init the __all__ var in case they want to use "*" to import all ~/anaconda3/lib/python3.8/importlib/__init__.py in import_module(name, package) 125 break 126 level += 1 --> 127 return _bootstrap._gcd_import(name[level:], package, level) 128 129 ~/anaconda3/lib/python3.8/site-packages/msaf/algorithms/cnmf/__init__.py in 8 """ 9 from .config import * ---> 10 from .segmenter import * ~/anaconda3/lib/python3.8/site-packages/msaf/algorithms/cnmf/segmenter.py in 5 import msaf.utils as U 6 from msaf.algorithms.interface import SegmenterInterface ----> 7 from msaf import pymf 8 9 ~/anaconda3/lib/python3.8/site-packages/msaf/pymf/__init__.py in 37 38 from .sivm import * ---> 39 from .sivm_sgreedy import * 40 from .sivm_search import * 41 from .sivm_gsat import * ~/anaconda3/lib/python3.8/site-packages/msaf/pymf/sivm_sgreedy.py in 19 20 from .dist import * ---> 21 from .vol import * 22 from .sivm_search import SIVM_SEARCH 23 ~/anaconda3/lib/python3.8/site-packages/msaf/pymf/vol.py in 17 from scipy.misc.common import factorial 18 except: ---> 19 from scipy.misc import factorial 20 21 __all__ = ["cmdet", "simplex"] ImportError: cannot import name 'factorial' from 'scipy.misc' (/home/aditya/anaconda3/lib/python3.8/site-packages/scipy/misc/__init__.py)
urinieto commented 2 years ago

Thanks for reporting. I need to do a full update of MSAF, since several libraries are outdated as of now. I recommend you creating a virtual env with those old versions to use MSAF with in the meantime.

dorienh commented 2 years ago

Running into the same issue with Colab.

I believe changing from scipy.misc import factorial to from scipy.special import factorial should do it.

Thanks for this library Uri!

urinieto commented 2 years ago

Thanks so much for the help, Dorien, and for the nice comment! :)