I tried this code
from numba import jit
from numpy import arange
@jit
def sum2d(arr):
M, N = arr.shape
result = 0.0
for i in range(M):
for j in range(N):
result += arr[i,j]
return result
a = arange(9).reshape(3,3)
print(sum2d(a))
and got a runtime exception: AttributeError: 'numpy.ndarray' object has no attribute '__code__'
I cannot find any version requirement on numpy in numba's documentation. Currently I have numpy 1.7.1 installed. My python version 2.6.6
What is the cause of the AttributeError?
EDIT
Some stacktrace info;
File "c:\pylib\numba\decorators.py", line 228, in _jit_decorator
if func.__code__.co_argcount == 0 and argtys is None:
AttributeError: 'numpy.ndarray' object has no attribute '__code__'
Locals:
argtypes: 'None'
argtys: 'None'
env: 'NumbaEnvironment(numba)'
env_name: 'None'
func: '[[0 1 2]\n [3 4 5]\n [6 7 8]]'
kwargs: '{backend:ast}'
restype: '<function sum2d at 0x1C89F5F0>'
np.ndarray.__code__
, I get the same error message. What version of numba are you using? – JoshAdel Mar 3 at 3:14