manim
Library3b1b/manim
Animation engine for creating precise explanatory math videos programmatically.
Overview
Manim is a Python engine that produces precise programmatic animations for explanatory math videos. It offers an intuitive syntax for defining objects and animations, and renders high-quality output with OpenGL and LaTeX support.
README Preview
\n \n \n \n\n\n[](https://pypi.org/project/manimgl/)\n[](http://choosealicense.com/licenses/mit/)\n[](https://www.reddit.com/r/manim/)\n[](https://discord.com/invite/bYCyhM9Kz2)\n[](https://3b1b.github.io/manim/)\n\nManim is an engine for precise programmatic animations, designed for creating explanatory math videos.\n\nNote, there are two versions of manim. This repository began as a personal project by the author of [3Blue1Brown](https://www.3blue1brown.com/) for the purpose of animating those videos, with video-specific code available [here](https://github.com/3b1b/videos). In 2020 a group of developers forked it into what is now the [community edition](https://github.com/ManimCommunity/manim/), with a goal of being more stable, better tested, quicker to respond to community contributions, and all around friendlier to get started with. See [this page](https://docs.manim.community/en/stable/faq/installation.html#different-versions) for more details.\n\n## Installation\n> [!Warning]\n> **WARNING:** These instructions are for ManimGL _only_. Trying to use these instructions to install [Manim Community/manim](https://github.com/ManimCommunity/manim) or instructions there to install this version will cause problems. You should first decide which version you wish to install, then only follow the instructions for your desired version.\n\n> [!Note]\n> **Note**: To install manim directly through pip, please pay attention to the name of the installed package. This repository is ManimGL of 3b1b. The package name is `manimgl` instead of `manim` or `manimlib`. Please use `pip install manimgl` to install the version in this repository.\n\nManim runs on Python 3.10 or higher.\n\nSystem requirements are [FFmpeg](https://ffmpeg.org/), [OpenGL](https://www.opengl.org/) and [LaTeX](https://www.latex-project.org) (optional, if you want to use LaTeX).\nFor Linux, [Pango](https://pango.org) along with its development headers are required. See instruction [here](https://
FAQ (5)
TroubleshootingHow to fix "ModuleNotFoundError: No module named 'trimesh' or 'pywavefront'" after installing Manim with pip install -e .?
The error occurs because trimesh and pywavefront were present in requirements.txt but missing from install_requires in setup.cfg, so an editable install did not install them.
Immediate workaround:
# Activate your virtual environment first
source venv/bin/activate # macOS/Linux
venv\Scripts\activate.bat # Windows Command Prompt
.\venv\Scripts\Activate.ps1 # Windows PowerShell
# Install the missing dependencies
pip install trimesh pywavefront
Permanent fix: add both packages to install_requires in setup.cfg, then reinstall:
pip install -e .The packaging issue was fixed in commit
4cec571c0; updating to a version containing that commit also resolves it.TroubleshootingWhy are SVG strokes missing when loading an SVG with SVGMobject in Manim?
In Manim v1.7.2, SVGMobject defaults stroke_width to 0.0, which overrides the stroke widths defined inside the SVG. As a workaround, pass stroke_width=None so the SVG's own stroke widths are preserved:
p = SVGMobject("Simple.svg", stroke_width=None)
The permanent fix is to upgrade to a Manim version containing the PR "Honor stroke widths declared in SVG files," which changes the default behavior so parsed per-path stroke widths are not reset to 0.0.
TroubleshootingHow to fix the 'pkg_resources is deprecated as an API' warning when running manimgl on Python 3.13?
Replace pkg_resources with the modern importlib.metadata API in the package's __init__.py:
try:
from importlib.metadata import version, PackageNotFoundError
except ImportError: # Python < 3.8
from importlib_metadata import version, PackageNotFoundError # type: ignore
try:
__version__ = version("manimgl")
except PackageNotFoundError:
__version__ = "unknown"
Remove the old code:
import pkg_resources
__version__ = pkg_resources.get_distribution("manimgl").version
For Python versions earlier than 3.8, install the backport with pip install importlib-metadata. This eliminates the deprecation warning on Python 3.13 and later.
TroubleshootingHow to fix ValueError: shapes (N,2) and (3,3) not aligned when using rotate_vector with VectorField in Manim?
This happens because VectorField passes all sample points to your function as a batched (N, 2) array, while rotate_vector tries to multiply it by a 3×3 rotation matrix. Update Manim to the latest master containing the batched 2D rotation fix:
pip install -U git+https://github.com/3b1b/manim.git
If you installed from a local clone:
git pull
pip install -e .
As an immediate workaround, apply a 2D rotation directly instead of calling rotate_vector:
def rotate_2d(vector, angle):
c, s = np.cos(angle), np.sin(angle)
rotation = np.array([
[c, -s],
[s, c],
])
return np.asarray(vector) @ rotation.T
def curl_func(p):
return rotate_2d(p / 3, PI / 2)
field_curl = VectorField(curl_func, axes)
This works for both single vectors and batched arrays of shape (N, 2).
TroubleshootingHow do I fix 'No matching distribution found for ipython>=8.18.0' when installing manim on Python 3.8?
The installation fails because ipython>=8.18.0 requires Python 3.9 or newer. Create the Conda environment with a supported Python version; use Python 3.10 because manimlib may also fail to import on Python 3.9:
conda create -n manim python=3.10
conda activate manim
pip install -e .
If the old environment already exists, remove it first with conda env remove -n manim, then recreate it.