Problem: Jupyter (Sage) with Numba and pypy
I install it by:
pip3 install numba
How to use and import numba, pypy in sage.
I get:
ModuleNotFoundError: No module named 'numba'
when I run the following code (from https://numba.pydata.org/numba-doc/la... )
from numba import jit
import numpy as np
import time
x = np.arange(100).reshape(10, 10)
@jit(nopython=True)
def go_fast(a): # Function is compiled and runs in machine code
trace = 0
for i in range(a.shape[0]):
trace += np.tanh(a[i, i])
return a + trace
start = time.time()
go_fast(x)
end = time.time()
print("Elapsed (with compilation) = %s" % (end - start))
start = time.time()
go_fast(x)
end = time.time()
print("Elapsed (after compilation) = %s" % (end - start))