title: What am I doing wrong with Numba here?
body: <p>I'm trying to learn how to use the Numba module. So far I haven't been able to get anything working because of some problem interfacing with NumPy. This is the code I'm running (from the Numba docs) and the error I get:</p>
  <pre><code>from numba import jit
  import numpy as np
  
  x = np.arange(100).reshape(10, 10)
  
  @jit(nopython=True) # Set &quot;nopython&quot; mode for best performance, equivalent to @njit
  def go_fast(a): # Function is compiled to machine code when called the first time
      trace = 0.0
      for i in range(a.shape[0]):   # Numba likes loops
          trace += np.tanh(a[i, i]) # Numba likes NumPy functions
      return a + trace              # Numba likes NumPy broadcasting
  
  print(go_fast(x))
  </code></pre>
  <pre><code>    Traceback (most recent call last):
  File &quot;C:/Users/JoHn/Documents/Current Classes/MEEN575_Optimization/HW6/Optimal_controller/angle_wrapping.py&quot;, line 84, in &lt;module&gt;
  print(go_fast(x))
  TypeError: expected dtype object, got 'numpy.dtype[float64]'
  </code></pre>
  <p>I know from some searching that this was or is a known error somewhat recently and had something to do with new builds of Numba requiring newer builds of NumPy or something like that, but as far as I can tell I have the most recent NumPy build, version 1.20. Any tips on what I'm doing wrong? To be clear I've never had a great understanding of how to cleanly setup environments in python so it is very possible I'm just missing something obvious here.</p>