Forums

Numba sum

Hi everyone,

I'm using pythonanywhere to host a dash app and am using numba to speed up the part with a high computation time. This works fine on my local machine, but on the pythonanywhere server I get the following error message:

Untyped global name 'sum': Cannot determine Numba type of &ltclass 'builtin_function_or_method'>

According to the numba documentation 'sum' is a supported function. Does anyone know why it doesn't work on the pythonanywhere server.

You'll find a MWE below. I'm using the pre-installed numba version '0.53.1'.

from numba import njit

@njit
def numba_test():
   return sum([1]*1000)
if __name__ == "__main__":
   numba_test()

I could reproduce it in that version on glastonbury system image with Python 3.9, but it worked fine in version 0.55.1 on the new haggis system image, with Python 3.10. Maybe consider upgrading your system image? See: https://help.pythonanywhere.com/pages/ChangingSystemImage/.

Thanks, that worked!

Glad to hear that!