This post is part of a series on what I learned as I taught myself how to use manim, the mathematical animation software behind the beautiful videos at 3blue1brown. Check them out if you haven’t seen any of them yet.
Important Note: These posts are based on an earlier version of manim which uses Python 2.7. The latest version of manim is using Python 3. To follow along with these posts, use Python 2.7 and the May 9, 2018 commit of manim .
1.0 Installing manim and Python
To get started you will need to have Python 2.7 installed and a copy of the
manim repository cloned to your computer. I recommend using Anaconda to install Python and use the virtual environment commands within Anaconda to manage the packages you need to install. I should note that I’m working in macOS so things might be a bit different in Windows or Linux.
- Install Python 2.7 from https://www.anaconda.com/download/
- Open a terminal and navigate to the folder you want to clone the
- In the terminal type
git clone https://github.com/3b1b/manim.git
- Create a virtual environment to house all the Python packages by typing
conda create -n manim27 python=2.7
- This will create an environment named
manim27(feel free to choose another name) and it will install a clean version of Python 2.7 in the environment.
- To activate your environment type
source activate manim27on macOS and Linux systems or
activate manim27on Windows systems. If you gave your environment a different name you can replace
manim27with the name you gave to your environment.
- In the terminal, navigate to the top-level folder of manim. You can identify this folder because it should have a file named
- To install the packages required for manim, type
pip install -r requirements.txt. These packages will be installed in your virtual environment and won’t affect any other installations of Python on your system.
- You will need to tell manim where to save your video files. Open
constants.py, which is in the top-level manim directory and change the directory listed under
MEDIA_DIRto be the place you want videos saved to. You will want to change
Dropbox (3Blue1Brown)/3Blue1Brown Team Foldershown below to be your desired output directory:
# Things anyone wishing to use this repository for their # own use will want to change MEDIA_DIR = os.path.join( os.path.expanduser('~'), "Dropbox (3Blue1Brown)/3Blue1Brown Team Folder" )
python extract_scene.py example_scenes.py SquareToCircle -pl. This should result in a video that shows a square turning into a circle. If this doesn’t work for you I can’t provide any tech support; I recommend you go to https://github.com/3b1b/manim/issues?q=is%3Aissue+is%3Aclosed to see the issues others have had getting manim to run.
- The output video file will show up in a subdirectory named
/animations/example_scenes/480p15/in the directory you specified for outputs in
There is also a Docker image available (see https://github.com/3b1b/manim at the bottom of the page) but I ran into issues getting it working on my machine.
In my next entry in this series we’ll start off creating our own animated scene.
UPDATE: Brian Howell has put together a great set of instructions installing manim and Python 3.7 together over at http://bhowell4.com/manic-install-tutorial-for-mac/. All of my posts are based on an older version of manim and using Python 2.7