title: How to display a GIF in jupyter notebook using google colab?
body: <p>I am using google colab and would like to embed a gif. Does anyone know how to do this? I am using the code below and it is not animating the gif in the notebook. I would like the notebook to be interactive so that one can see what the code animates without having to run it. </p>
  
  <p>I found many ways to do so that did not work in Google colab. The code and the GIF of interest is below.</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import matplotlib.image as mpimg
  
  img = mpimg.imread("/content/animationBrownianMotion2d.gif")
  plt.imshow(img)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/DN1Bq.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/DN1Bq.gif" alt="enter image description here"></a></p>
  
  <p>I tried some of the solutions provided.</p>
  
  <pre><code>import IPython
  from IPython.display import Image
  Image(filename='/content/animationBrownianMotion2d.gif')
  </code></pre>
  
  <p>and similarly</p>
  
  <pre><code>import IPython
  from IPython.display import Image
  Image(filename='/content/animationBrownianMotion2d.gif',embed=True)
  </code></pre>
  
  <p>but got the error,</p>
  
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-27-56bf6cd2b134&gt; in &lt;module&gt;()
        1 import IPython
        2 from IPython.display import Image
  ----&gt; 3 Image(filename='/content/animationBrownianMotion2d.gif',embed=True)
        4 
  
  /usr/local/lib/python3.6/dist-packages/IPython/core/display.py in __init__(self, data, url, filename, format, embed, width, height, retina, unconfined, metadata)
     1013 
     1014         if self.embed and self.format not in self._ACCEPTABLE_EMBEDDINGS:
  -&gt; 1015             raise ValueError("Cannot embed the '%s' image format" % (self.format))
     1016         self.width = width
     1017         self.height = height
  
  ValueError: Cannot embed the 'gif' image format
  </code></pre>
  
  <p>both times.</p>