python-3.xwarningslibrosa

Ignore all warnings from a module


i'm having some problems with librosa python module. It shows me the following warning at import.

/opt/anaconda3/envs/pox/lib/python3.6/site-packages/librosa/util/decorators.py:9: NumbaDeprecationWarning: An import was requested from a module that has moved location.
Import of 'jit' requested from: 'numba.decorators', please update to use 'numba.core.decorators' or pin to Numba version 0.48.0. This alias will not be present in Numba version 0.50.0.
  from numba.decorators import jit as optional_jit

since my code seems to work fine i just would like to don't show this warning anymore (i tried to fix it but i couldn't). I have tried to use warnings module like so

import librosa
import warnings
warnings.filterwarnings("ignore")

but the same warning is shown. (i'm using anaconda python's 3.6 virtual enviroment)


Solution

  • Try:

    import warnings
    from numba.errors import NumbaPerformanceWarning
    warnings.filterwarnings("ignore", category=NumbaPerformanceWarning)
    

    If the above doesn't work:

    import warnings
    warnings.filterwarnings("ignore", category=DeprecationWarning)