How to install manimgl on Google Colab?

Viewed 845
1 Answers

I found a relatively simple way to do it. Actually there is a lib called jupyter-manim that works pretty well with a few tweaks. Here is what I did:

!apt-get install -qq pkg-config libcairo2-dev 
!pip3 install jupyter-manim --quiet
!sudo apt-get -qq update
!sudo apt-get install -qq texlive-full

The -qq is simply not to get prompts output.

FYI, the whole installation is a little long (about 5 min).

Then, you should be able to run:

import jupyter_manim
from manimlib.imports import *
import statistics

%%manim OpeningScene --base64
class OpeningScene(Scene):
    def construct(self):
        first_line = TextMobject("Data Structures and Algorithms")
        second_line = TextMobject("Time Complexity and Big O Notation")
        self.play(Write(first_line))
        self.wait(2)
        self.play(Transform(first_line, second_line))
        self.wait(3)
        self.play(FadeOut(first_line))

I got inspired from this notebook: https://colab.research.google.com/drive/1KDPi9Im-dfknrUokBpSwEM6Z710JF6Wc?usp=sharing#scrollTo=9BpcNKiWZeu-

Related