Skip to content

Instantly share code, notes, and snippets.

@leihuagh
Created August 4, 2020 01:29
Show Gist options
  • Save leihuagh/f2f99163c93d882dcfa6816af24fc33b to your computer and use it in GitHub Desktop.
Save leihuagh/f2f99163c93d882dcfa6816af24fc33b to your computer and use it in GitHub Desktop.
Setup virtual env for Manim

Setup Manim Virtual Environment

Create Project Location

cd \
cd projects/<path-to-place>
mkdir myanimations
cd myanimations

Create Virtual Environment

virtualenv -p python env
.\env\scripts\activate # Windows
source env/scripts/activate # mac

Clone manim

  • Make sure the virtual environment is activate
git clone https://github.com/3b1b/manim

Remove .git

cd manim
rm -rf .git # Remove develoer's 
git init # Start your own

Load to Visual Student Code

  • Make sure you are in manim directory
code .

Modify requirements.txt If in Windows

  • In Visaul Studio Code, open file requirements.txt
  • Remove last line ; sys_platform == 'win32'
  • Remove pycairo because we need to install it manully in separated process
  • Save the file and run command below in command line

Check Current Installed Packages in Virtual Environment

  • It should be empty
python -m pip freeze

Install Packages List on requirements.txt

python -m pip install -r requirements.txt
python -m pip freeze

Manually Download and Install pycairo

Download

  • In Google Search Engine, type unofficial python packages
  • The Unofficial Windows Binaries for Python Extension Packages will show on the top
  • Ctrl+F to activate Find field and type pycairo to search
  • Click on pycairo, you will be located into the download place
  • Chose the one can match your system. In my case, I chose pycairo‑1.19.1‑cp38‑cp38‑win_amd64.whl
  • Download and move it in anywhere in your computer and you can easy to remebered. I put in C:\data\wheels\

Install pycairo

  • In your command line, make sure
    • the project is activated
    • your virtual environment package env and manim directories should be parallel
    • Make sure you underneath manim directory
python -m pip install c:\data\wheels\pycairo-1.19.1-cp38-cp38-win_amd64.whl
python -m pip freeze

(Optional) Remove Unused manim Stuff

  • Underneath manim, remove
    • .github folder
    • travis.yml
    • all docker files

Run Test

  • In command line type
python -m manim example_scenes.py -pl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment