bmcfee / resampy

Efficient sample rate conversion in python
https://resampy.readthedocs.io
ISC License
253 stars 36 forks source link

Issues with Numba 0.55.2 #103

Closed bendikhk closed 2 years ago

bendikhk commented 2 years ago

We are experiencing errors with Resampy 0.3.0 and Numba 0.55.2. Downgrading to Resampy 0.2.2 fixes the issue. Error log below.

` TypingError('Failed in nopython mode pipeline (step: nopython frontend)\n\x1b[1m\x1b[1mNo implementation of function F...ta[offset + i index_step])\n\x1b[1m y[t] += weight x[n-i]\n\x1b[0m \x1b[1m^\x1b[0m\x1b[0m\n') issue_type = 'typing'

def error_rewrite(e, issue_type):
    """
    Rewrite and raise Exception `e` with help supplied based on the
    specified issue_type.
    """
    if config.SHOW_HELP:
        help_msg = errors.error_extras[issue_type]
        e.patch_message('\n'.join((str(e).rstrip(), help_msg)))
    if config.FULL_TRACEBACKS:
        raise e
    else:
       raise e.with_traceback(None)
       numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
       No implementation of function Function(<built-in function iadd>) found for signature:

        >>> iadd(array(int32, 1d, C), array(float64, 1d, C))

       There are 16 candidate implementations:
          - Of which 12 did not match due to:
          Overload of function 'iadd': File: <numerous>: Line N/A.
            With argument(s): '(array(int32, 1d, C), array(float64, 1d, C))':
           No match.
          - Of which 2 did not match due to:
          Overload in function 'NumpyRulesInplaceArrayOperator.generic': File: numba/core/typing/npydecl.py: Line 244.
            With argument(s): '(array(int32, 1d, C), array(float64, 1d, C))':
           Rejected as the implementation raised a specific error:
             AttributeError: 'NoneType' object has no attribute 'args'
         raised from /home/user/anaconda3/envs/env/lib/python3.9/site-packages/numba/core/typing/npydecl.py:255
          - Of which 2 did not match due to:
          Operator Overload in function 'iadd': File: unknown: Line unknown.
            With argument(s): '(array(int32, 1d, C), array(float64, 1d, C))':
           No match for registered cases:
            * (int64, int64) -> int64
            * (int64, uint64) -> int64
            * (uint64, int64) -> int64
            * (uint64, uint64) -> uint64
            * (float32, float32) -> float32
            * (float64, float64) -> float64
            * (complex64, complex64) -> complex64
            * (complex128, complex128) -> complex128

       During: typing of intrinsic-call at /home/user/anaconda3/envs/env/lib/python3.9/site-packages/resampy/interpn.py (44)

       File "../../anaconda3/envs/env/lib/python3.9/site-packages/resampy/interpn.py", line 44:
       def _resample_f(x, y, t_out, interp_win, interp_delta, num_table, scale=1.0):
           <source elided>
                   weight = (interp_win[offset + i * index_step] + eta * interp_delta[offset + i * index_step])
                   y[t] += weight * x[n-i]
                   ^

../../anaconda3/envs/env/lib/python3.9/site-packages/numba/core/dispatcher.py:409: TypingError `

bmcfee commented 2 years ago

Can you provide an example that triggers this error? My hunch here is that it's not a numba version issue (I'm also on 0.55.2) but something is coming up integer-typed when it needs to be floating point.

bmcfee commented 2 years ago

@bendikhk just as a heads up, the PR I just merged (#104) might resolve this issue for you. If you have a chance, could you try installing it and give it a whirl? If it does fix it for you, I'll push the 0.3.1 release. If it doesn't, I'd like to get your issue resolved before release.

bendikhk commented 2 years ago

@bmcfee Yep, the fix has resolved our issue. Thank you for the quick response! :)

bmcfee commented 2 years ago

Excellent, thanks for letting me know. I'll push the release then.