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
- Temporary fix for librosa import failure due to change in `numba`. Can remove once librosa package updated (https://github.com/librosa/librosa/issues/1160). PiperOrigin-RevId: 316113849 Change-Id: I8... — committed to magenta/magenta by adarob 4 years ago
- handling librosa conflict with numba https://github.com/librosa/librosa/issues/1160 — committed to mozilla/TTS by deleted user 4 years ago
- Fix requirements.txt See: https://github.com/librosa/librosa/issues/1160 — committed to Hongqin-Li/speech-command-recognition by Hongqin-Li 4 years ago
- update test server_config and mitigate https://github.com/librosa/librosa/issues/1160 in server package test — committed to mozilla/TTS by erogol 4 years ago
- set versions of software and added 'numba==0.48' : https://github.com/librosa/librosa/issues/1160#issuecomment-652771127 — committed to a-n-rose/Python-Sound-Tool by a-n-rose 4 years ago
- fix librosa module not found error Fixes the below error from librosa: ModuleNotFoundError: No module named 'numba.decorators' See https://github.com/librosa/librosa/issues/1160 Signed-off-by: Csab... — committed to cskiraly/dcase2020_task2_baseline by cskiraly 4 years ago
- Add correct numba version to the installation seems like numba removed the decorators module with version 0.50. This breaks the current code. See in: https://github.com/librosa/librosa/issues/1160 — committed to YoavRamon/Conv-TasNet by YoavRamon 4 years ago
- Update librosa/numba in CI librosa 0.8.0 has been released which include fix for https://github.com/librosa/librosa/issues/1160 at https://github.com/librosa/librosa/pull/1164 — committed to mthrok/audio by mthrok 4 years ago
- Update librosa/numba in CI (#864) librosa 0.8.0 has been released which include fix for https://github.com/librosa/librosa/issues/1160 at https://github.com/librosa/librosa/pull/1164 — committed to pytorch/audio by mthrok 4 years ago
- Added numba dependancy change There was a version mismatch with the old 'librosa' install and the newer 'numba' dependancy. Fixed by just specifying an older version of numba. https://github.com/... — committed to jacob-parmer/VAD by jacob-parmer 3 years ago
pip install numba==0.48seems likenumbaremoved thedecoratorsmodule with version 0.50. real fix would be pinningnumbaversion 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.8will hit this installation bug.I fixed that by install librosa 0.7.2 with numba 0.45.0
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.
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?
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
This works! Thank you!
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.