Skip to content
Advertisement

How to use manim from any directory in windows

I am trying to execute command python -m manim example_scenes.py SquareToCircle -pl from any directory in my windows machine. It works fine when I execute the command in the root directory of manim library(directory which contains requirement.txt, README.md and all those stuff). I tried to edit the path environment variable of my system but it still does not work.

ERROR –

C:UserssuccuAppDataLocalProgramsPythonPython38python.exe: No module named manim

I am sure that I have edited my path variable correctly because I can call out README.md and requirements.txt files in manim root directory from and location.

How can I solve this issue? My python version is 3.8.6

Advertisement

Answer

There is no problem with your installation, what happens is that you are using Manim locally, when you run:

python -m manim ...

Is the same as:

python manim.py ...

That is, you are executing the manim.py module (the file) which is in a local copy of Manim, and therefore you cannot move it. The best way to solve it is to create a virtual environment, either with virtualenv or Anaconda, install the Manim dependencies again and install Manim to the Path of that virtual environment. If you use virtualenv it would be:

# Install virtualenv
C:...> python -m pip install virtualenv

# Move to some safe place, where that it will not be eliminated
C:...> cd C:save_place...

# Create and activate a virtual env
C:save_place...> virtualenv manimenv
C:save_place...> .manimenvSourceactivate
(manimenv) C:save_place...> 

# Download here the repo and install it
(manimenv) C:save_place...> pip install -e .

# Try run manim - You don't need the 'python -m manim', only 'manim'
(manimenv) C:save_place...> manim example_scenes.py WriteStuff -pl

And thats it, the advantage of this is that the manim command will only be available in your virtual environment, and you will have to activate it every time you need it.

More info: Learn to use virtualenv

Advertisement