Numba: NotImplementedError: Use of unknown opcode STORE_GLOBAL

Created on 4 Jul 2017  路  4Comments  路  Source: numba/numba

Hi,

I added those two lines at the beginning of my script like the homepage example says :

from numba import jit
@jit

I have a global variable in a function.

When I run the script, I get this error message :

NotImplementedError: Use of unknown opcode STORE_GLOBAL at line xx of yyyyyy.py

Can you help ?

Most helpful comment

Numba doesn't let you modify global variables in compiled functions. You need to use return values, or modify the contents of NumPy arrays.

All 4 comments

Thanks for the report. What you see is I believe correct behaviour. Numba treats globals as compile time constants so the notion of writing to a global (the STORE_GLOBAL opcode) is invalid. This entry in the FAQ might help?

What must I do to make my Python script work ?

Numba doesn't let you modify global variables in compiled functions. You need to use return values, or modify the contents of NumPy arrays.

Thanks, I'll have a look into my code if ever my internship is renewed :)

Was this page helpful?
0 / 5 - 0 ratings