I'm trying to learn manim and in vscode, whenever I try running a program in vscode with manim sideview, or the program in a terminal with python3 filename.py
it always says No module named 'manim'
. Also, just in case this helps, I am on arch linux.
I'm just gonna use this example program here to show what I've tried:
from manim import *
class TestBelow(Scene):
def construct(self):
c = Circle()
c.set_fill(BLUE, opacity=0.8)
t = Text("Circle").next_to(c, DOWN)
self.play(Write(c), Write(t))
self.wait(2)
Now, when running manim -pqh filename.py TestBelow
it works fine, but when running that with actual python, it always says No module named manim
.
Also, the way I installed manim, I used the linux tutorial at Manim Local Tutorial thing. When I run uv pip show manim
it returns Package(s) not found for:**manim**
. When I run import sys; print(sys.path)
(in the python terminl thing idk what to call it) it returns ['', '/usr/lib/python313.zip', '/usr/lib/python3.13', '/usr/lib/python3.13/lib-dynload', '/usr/lib/python3.13/site-packages']
.
I'm not sure whether you installed manim using
uv init xxx
cd xxx && uv add manim
which installs manim package to your specific project (in this case xxx)
or uv tool install manim
which installs manim as a global
These two different ways requires different approaches when running the code importing manim packages you just installed
If u are using uv projects feature, IDE like VSCode should automatically detect the virtual environment you created with uv init
and thus finds manim.
You can check whether you are using virtual environment with which python3
. If so, the output should be like xxx/.venv/bin/python3
. And if not (probably using system /usr/lib/python3), you have to source .venv/bin/activate
to activate your environment where manim is installed (In VSCode you can select it in the right-bottom corner) or uv run filename.py
to manually specify using the environment. Otherwise, python interpreter cannot find manim and will say No module named 'manim'
.
Although using project is suggested, manim docs also guides how to set up your code editor when using uv global tool.