1. Installing manim

For this demonstration, I’ll be using Fedora 29 as well as Ubuntu 18.04. The steps should be similar for any Linux distribution and/or mac.

The first step would be to clone the manim’s repository form https://github.com/3b1b/manim

$ git clone https://github.com/3b1b/manim.git

Before we start installing the python packages, we need to satisfy some prequsite, namely cairo, latex, ffmpeg, and sox. A very brief and unjustifiable description of the four is given below:

cario: 2D graphics library
latex: A high-quality typesetting system
ffmpeg: Rendering videos
sox: Sound Processing

To install the prequsites  in Fedora:

$ sudo dnf install cairo-devel ffmpeg sox texlive-scheme-full

Similarly, in Ubuntu:

$ sudo apt install libcairo2-dev ffmpeg sox texlive-full

For the sake of convenience, I’ll be using a virtual environment. It is optional, If you think it is too much, you can skip to pip installation.

To create a virtual environment make a new directory, envs where you cloned manim. Then execute:

$ python3 -m venv manim-venv

That’ll create a new directory manim-venv,  once that directory is created, activate the virtual environment using

$ source manim-venv/bin/activate

Once that is done, enter the manim directory (for me it’s ~/Documents/manim) and we’re ready to install the python libraries.

(manim-venv) jarwin@MilleniumFalcon:manim $ python3 -m pip install -r requirements.txt

if you didn’t go with virtual environment, it’ll look like:

jarwin@MilleniumFalcon:manim $ python3 -m pip install -r requirements.txt

If everything goes right, you’re all set, but since we live in a chaotic universe, it is unlikely that odds will turn out in our favour.

The two errors that I faced while installing were based on cario and latex. Namely,

Exception: Latex error converting to dvi. See log output above or the log file This error indicates that the latex is not installed and/or required packages are not installed in latex. Instead of trying to work my way around it, I just installed texlive-scheme-full, but if you don’t wanna do that, you can see if all the packages mentioned here are installed.

The second error that I got was on cario. Absentmindedly, I was trying to install pycario without a cario backend in my system and was greeted blissfully by:

Error on pycario: failed with error code 1 in /tmp/pip-install-mgw5hikm/pycairo/

To check if the installation was successful, go to manim’s root directory (cross your fingers) and run:

python3 -m manim example_scenes.py SquareToCircle -l

If everything is working, then you should see the video of square transforming into a circle. The video will be saved in manim/media/videos/example_scenes as a .mp4 file.
(As you would have guessed, each python file will have its separate folder inside the media directory).
If you don’t see the video, that means something’s wrong with your installation process, retracing your steps or starting again would be a good idea.

Finally, there’s just one last thing that we have to do to make it more convenient for us to start away. In lieu of a recent pull request, we will add the current manim directory to PYTHONPATH. (I’ll explain why we’re doing it in the next tutorial)

For Fedora & Ubuntu, to add manim repo to PYTHONPATH, execute:

echo "export PYTHONPATH=:~/Path/to/manim" >> ~/.bashrc # for bash
echo "export PYTHONPATH=:~/Path/to/manim" >> ~/.zshrc # for zsh

With all the housekeeping out of the way, we’re now actually ready now start rendering videos in manim. Follow along to the next tutorial.

2 thoughts on “1. Installing manim

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.