3b1b / manim

Animation engine for explanatory math videos
MIT License
61.81k stars 5.75k forks source link

No module named manim #483

Open naufanaurezan opened 5 years ago

naufanaurezan commented 5 years ago

After I updated manim to the latest version, whenever I try to run: python3 -m manim example_scenes.py SquareToCircle -pl It will return as: /usr/local/bin/python3: No module named manim.

Full code:

PS C:\Users\User\Downloads\Manim> docker run -itv C:\Users\USER\Downloads\Manim:/root/manim eulertour/manim
root@f4b2d3c43ad7:~# cd manim
root@f4b2d3c43ad7:~/manim# python3 -m manim example_scenes.py SquareToCircle -pl
/usr/local/bin/python3: No module named manim

I'm using Docker, and I have already pulled the latest version.

eulertour commented 5 years ago

Sorry, I haven't been giving the dockerfile as much attention as I ought to. Try passing -e PYTHONPATH=/root/manim to docker run.

naufanaurezan commented 5 years ago

You mean together like this? docker run -e C:\Users\USER\AppData\Local\Programs\Python\Python37-32\=/root/manim -itv C:\Users\USER\Downloads\Manim:/root/manim eulertour/manim

eulertour commented 5 years ago

No, just the way I typed it above. The environment variable needs to be set in the container, so it won't change based on your system.

naufanaurezan commented 5 years ago

Now it outputs me this:

PS C:\Users\User\Downloads\Manim> docker run -e C:\Users\USER\AppData\Local\Programs\Python\Python37-32\=/root/manim eulertour/manim
PS C:\Users\User\Downloads\Manim> docker run -itv C:\Users\USER\Downloads\Manim:/root/manim eulertour/manim
root@ea83d3837c81:~# cd manim
root@ea83d3837c81:~/manim# python3 -m manim example_scenes.py SquareToCircle -pl
/usr/local/bin/python3: No module named manim
root@ea83d3837c81:~#         

EDIT: I forgot to add cd manim to it. I cannot do plain docker run -e C:\Users\USER\AppData\Local\Programs\Python\Python37-32\=/root/manim though, it requires the image argument.

eulertour commented 5 years ago

Try following the new docker instructions using docker-compose and let me know if you encounter any problems.

naufanaurezan commented 5 years ago

I'm confused at this line: MANIM_PATH=/absolute/path/to/manim/repo docker-compose run manim example_scenes.py SquareToCircle -l Am I supposed to type exactly like that? Also should I set the environment variables using docker run -e MANIM_PATH=C:/Users/User/Downloads/Manim eulertour/manim or is there another way?

yoshiask commented 5 years ago

Windows tends to not play nicely with the -m flag. If I'm not mistaken, that flag is not necessary to run the script.

Try python3 manim.py example_scenes.py SquareToCircle -pl in Command Prompt. (Make sure you're in the manim folder.)

naufanaurezan commented 5 years ago

Windows tends to not play nicely with the -m flag. If I'm not mistaken, that flag is not necessary to run the script.

Try python3 manim.py example_scenes.py SquareToCircle -pl in Command Prompt. (Make sure you're in the manim folder.)

That didn't do anything.

eulertour commented 5 years ago

The intention is to set the MANIM_PATH environment variable to the absolute path to your manim repo. However, I'm not sure how to do that with Windows.

naufanaurezan commented 5 years ago

So I messed around with the docker-compose.yml file and changed the version to "3.2":

version: '3.2'

services:
  manim:
    # comment this line if you build the image to prevent overwriting the tag
    # image: eulertour/manim:latest
    # uncomment this line to build rather than pull the image
    build: .
    volumes:
      - ${MANIM_PATH=?MANIM_PATH environment variable isn't set}:
      - MANIM_PATH=C:/Users/User/Downloads/Manim
    environment:
      - PYTHONPATH=C:/Users/USER/AppData/Local/Programs/Python/Python37-32/
    working_dir: /opt/manim
    entrypoint:
      - python
      - -m
      - manim
    network_mode: "none"

And now it outputs:

PS C:\Users\User\Downloads\Manim> docker-compose run manim example_scenes.py SquareToCircle -l
ERROR: The Compose file '.\docker-compose.yml' is invalid because:
services.manim.volumes 'type' is a required property

Maybe I'm going in the right direction with this. Also do I need to change whatever PYTHON_PATH value is and what's about the working_dir?

naufanaurezan commented 5 years ago

I removed this entirely:

      - ${MANIM_PATH=?MANIM_PATH environment variable isn't set}:
      - MANIM_PATH=C:/Users/User/Downloads/Manim

leaving just - type: bind, and it began to do something:

PS C:\Users\User\Downloads\Manim> docker-compose run manim example_scenes.py SquareToCircle -l
Building manim
Step 1/5 : FROM python:3.7
3.7: Pulling from library/python
e79bb959ec00: Downloading [==========>                                        ]  9.649MB/45.34MB
1b2a72d4e030: Download complete                                                                 
d54db43011fd: Downloading [=====>                                             ]  5.078MB/50.07MB
69d473365bb3: Waiting                                                                           
7dc3a6a0e509: Waiting                                                                           
68cd774d0852: Waiting                                                                           
2ef86095a118: Waiting                                                                           
42c091edeef0: Waiting 

I tried to include the MANIM_PATH along with the - type: bind, but it will produce an error instead. I cd to the local repo within the powershell beforehand, maybe that's the main intention of MANIM_PATH?

eulertour commented 5 years ago

The purpose of that line is to specify a manim repo to bind mount into the container. The variables set in the environment section of the Compose file are variables set in the (linux) container, so setting them to a windows path won't be helpful.

yoshiask commented 5 years ago

@eulertour, would adding MANIM_PATH to the Windows environment variables be a solution here?

Tridu33 commented 5 years ago

For my PC,reboot can do good.I install manim in my WSL-Ubuntu,I reboot my PC and it work.