title: How to fix 'ModuleNotFoundError: 'kivy.garden.matplotlib.backend_kivyagg''
body: <p>I am learning how to use matplotlib with kivy. When I run the code below, it breaks and throws 'ModuleNotFoundError: No module named 'kivy.garden.matplotlib.backend_kivyagg''. </p>
  
  <p>Tried looking up possible issues, some of which advised reverting back to matplotlib 2.2.2. I tried this and it still does not work. Open to any advice.</p>
  
  <pre><code>#Importing Packages
  import numpy as np
  import matplotlib.pyplot as plt
  from matplotlib.widgets import TextBox
  
  from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg
  from kivy.app import App
  from kivy.uix.boxlayout import BoxLayout
  
  #adding figure and ax box to the screen
  fig, ax = plt.subplots()
  #setting distance from bottom for flot
  plt.subplots_adjust(bottom=0.2)
  
  #setting initial x limits and precision
  x = np.arange(-5.0, 5.0, 0.001)
  
  #setting initial function and plotting
  y = x ** 2
  initial_text = "x ** 2"
  l, = plt.plot(x, y, linewidth=2)
  
  #defining the function of updating text
  def submit(text):
      ydata = eval(text)
      l.set_ydata(ydata)
      ax.set_ylim(np.min(ydata), np.max(ydata))
      plt.draw()
  
  #setting dimensions and location of text box
  axbox = plt.axes([0.25, 0.05, 0.5, 0.075])
  text_box = TextBox(axbox, 'f(x) = ', initial=initial_text)
  text_box.on_submit(submit)
  
  
  class MyApp(App):
  
      def build(self):
          box = BoxLayout()
          box.add_widget(FigureCanvasKivyAgg(plt.gcf()))
          return box
  
  MyApp().run()
  </code></pre>
  
  <p>The only issue here is the FigureCanvasKivyAgg() function, which cannot be imported.</p>