librosa: ModuleNotFoundError: No module named 'numba.decorators'

Describe the bug import librosa breaks on latest librosa and numba. Upstream dependency break

librosa==0.7.2 numba==0.50.0

To Reproduce

import librosa
.tox/s-py38/lib/python3.8/site-packages/librosa/util/utils.py:15: in <module>
    from .decorators import deprecated
.tox/s-py38/lib/python3.8/site-packages/librosa/util/decorators.py:9: in <module>
    from numba.decorators import jit as optional_jit
E   ModuleNotFoundError: No module named 'numba.decorators'

Workaround Pin numba in production

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 37
  • Comments: 23 (5 by maintainers)

Commits related to this issue

Most upvoted comments

pip install numba==0.48 seems like numba removed the decorators module with version 0.50. real fix would be pinning numba version in librosa requirements

@waffletower if you want to complain about python devs not adhering to semantic versioning practices, go right ahead. But please do it elsewhere. Comments like yours here will not be tolerated in this forum.

I am sorry, but we don’t have to waste time as often on careless breakage exactly like this in other ecosystems such Java, Erlang or Swift in my direct and broad experience. My do so many tolerate Python amateur hour? Why don’t Python developers understand the concept of pinning and downstream consequences? The amount of time wasted for countless developers for inconsiderate breakage like this is staggering.

https://docs.divio.com/en/latest/how-to/resources-pin-dependencies/

Thank you @yemata Closing as duplicate of #1105, fixed by #1107

@bmcfee i’m starting to think that it might be good to make an 0.7.3 release before 0.8.0 If not, everyone package requiring librosa<0.8 will hit this installation bug.

pip install numba==0.48 seems like numba removed the decorators module with version 0.50. real fix would be pinning numba version in librosa requirements

With python3.6 venv and librosa==0.7.2 and numba==0.48 I get an Assertion Error upon importing librosa.

.../venv_36/lib/python3.6/site-packages/numba/targets/cpu.py in <module>
     12 from numba import utils, cgutils, types
     13 from numba.utils import cached_property
---> 14 from numba.targets import (
     15     callconv, codegen, externals, intrinsics, listobj, setobj, dictimpl,
     16 )

.../venv_36/lib/python3.6/site-packages/numba/targets/listobj.py in <module>
   1069 
   1070 @overload_method(types.List, "sort")
-> 1071 def ol_list_sort(lst, key=None, reverse=False):
   1072 
   1073     _sort_check_key(key)

.../venv_36/lib/python3.6/site-packages/numba/core/extending.py in decorate(overload_func)

.../venv_36/lib/python3.6/site-packages/numba/core/typing/templates.py in make_overload_method_template(typ, attr, overload_func, inline)

.../venv_36/lib/python3.6/site-packages/numba/core/typing/templates.py in make_overload_attribute_template(typ, attr, overload_func, inline, base)

AssertionError: 

I fixed that by install librosa 0.7.2 with numba 0.45.0

Please, do it ASAP. Hits really hard with automated daily builds.

Sorry, but we don’t have the time/bandwidth to put out a point release right now. I generally recommend pinning the numba version until the librosa 0.8 release comes out in a few weeks.

Thank you @yemata Closing as duplicate of #1105, fixed by #1107

@bmcfee i’m starting to think that it might be good to make an 0.7.3 release before 0.8.0 If not, everyone package requiring librosa<0.8 will hit this installation bug.

Please, do it ASAP. Hits really hard with automated daily builds.

Got the same error. Solved it with ` pip uninstall --yes librosa

pip install librosa --force-reinstall `

@waffletower

Definitely users should always pin for robust production. I’m with you there. If you notice the original post and comments, folks are reporting routine breaks in testing, not complaining about blocking breaks in production.

Many people who are breaking in production are googling and finding this though, so I appreciate your commentary calling out the awfully bad practice of not pinning production.

Everyone is unique in where they are at in their journey. You know you shot yourself in the foot with dependency pinning when you first started. Python doesn’t exactly have great design, standardization, or documentation around pip, deployment and “one good way to do things”. Any ideas on how to improve the ecosystem to make it simpler and easier, apart from getting the word out to pin production?

The problem is that I cannot install numba==0.48 for my M1 Macbook. Is there a more general solution? Please

Solved this problem by simply commenting the line “from numba.decorators import jit as optional_jit” in the file “librosa/util/decorators.py”.

Configuration: librosa = 0.7.2 numba = 0.56.2

conda install numba==0.48 conda install librosa==0.6.3

–> solution: install numba firstly

Got the same error. Solved it with ` pip uninstall --yes librosa

pip install librosa --force-reinstall `

This works! Thank you!

得到同样的错误。 用 ` pip uninstall --yes librosa解决了它

pip install librosa --force-reinstall `

it works! thank u

This bug is occur when you have librosa version less than 0.8. First install numba of any version then after install librosa if you want to install librosa less than 0.8.