manim icon indicating copy to clipboard operation
manim copied to clipboard

LaTeX/ManimGL error while launching

Open SlPandor opened this issue 4 years ago • 8 comments

I'm trying to launch the first example scene and everything else works but LaTeX. I get these cramped words, no further animation and an error. Ekrānuzņēmums (284)

Code:

from manimlib import * import numpy as np

class OpeningManimExample(Scene): def construct(self): intro_words = Text(""" The original motivation for manim was to better illustrate mathematical functions as transformations. """) intro_words.to_edge(UP)

    self.play(Write(intro_words))
    self.wait(2)

    # Linear transform
    grid = NumberPlane((-10, 10), (-5, 5))
    matrix = [[1, 1], [0, 1]]
    linear_transform_words = VGroup(
        Text("This is what the matrix"),
        IntegerMatrix(matrix, include_background_rectangle=True),
        Text("looks like")
    )
    linear_transform_words.arrange(RIGHT)
    linear_transform_words.to_edge(UP)
    linear_transform_words.set_stroke(BLACK, 10, background=True)

    self.play(
        ShowCreation(grid),
        FadeTransform(intro_words, linear_transform_words)
    )
    self.wait()
    self.play(grid.animate.apply_matrix(matrix), run_time=3)
    self.wait()

    # Complex map
    c_grid = ComplexPlane()
    moving_c_grid = c_grid.copy()
    moving_c_grid.prepare_for_nonlinear_transform()
    c_grid.set_stroke(BLUE_E, 1)
    c_grid.add_coordinate_labels(font_size=24)
    complex_map_words = TexText("""
        Or thinking of the plane as $\\mathds{C}$,\\\\
        this is the map $z \\rightarrow z^2$
    """)
    complex_map_words.to_corner(UR)
    complex_map_words.set_stroke(BLACK, 5, background=True)

    self.play(
        FadeOut(grid),
        Write(c_grid, run_time=3),
        FadeIn(moving_c_grid),
        FadeTransform(linear_transform_words, complex_map_words),
    )
    self.wait()
    self.play(
        moving_c_grid.animate.apply_complex_function(lambda z: z**2),
        run_time=6,
    )
    self.wait(2)

Error:

PS C:\Users\Ab> cd manim PS C:\Users\Ab\manim> manimgl example_scenes.py OpeningManimExample Warning: Using the default configuration file, which you can modify in c:\users\Ab\manim\manimlib\default_config.yml If you want to create a local configuration file, you can create a file named custom_config.yml, or run manimgl --config ERROR:root:left[\begin{array}{c}\quad \\quad \\end{array}\right]"

LaTeX Error! Not a worry, it happens to the best of us.

Traceback (most recent call last): File "C:\Users\Ab\AppData\Local\Programs\Python\Python39\Scripts\manimgl-script.py", line 33, in File "c:\users\Ab\manim\manimlib_main_.py", line 17, in main scene.run() File "c:\users\Ab\manim\manimlib\scene\scene.py", line 75, in run self.construct() File "example_scenes.py", line 29, in construct IntegerMatrix(matrix, include_background_rectangle=True), File "c:\users\Ab\manim\manimlib\mobject\matrix.py", line 81, in init self.add_brackets() File "c:\users\Ab\manim\manimlib\mobject\matrix.py", line 111, in add_brackets bracket_pair = Tex("".join([ File "c:\users\Ab\manim\manimlib\mobject\svg\tex_mobject.py", line 163, in init super().init(full_string, **kwargs) File "c:\users\Ab\manim\manimlib\mobject\svg\tex_mobject.py", line 42, in init filename = tex_to_svg_file(full_tex) File "c:\users\Ab\manim\manimlib\utils\tex_file_writing.py", line 52, in tex_to_svg_file tex_to_svg(tex_file_content, svg_file) File "c:\users\Ab\manim\manimlib\utils\tex_file_writing.py", line 60, in tex_to_svg svg_file = dvi_to_svg(tex_to_dvi(tex_file)) File "c:\users\Ab\manim\manimlib\utils\tex_file_writing.py", line 94, in tex_to_dvi with open(log_file, "r") as file: FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\AB~1\AppData\Local\Temp\Tex\c3372cf5b2620435.log'

I've changes username here, but it is valid(only latin letters).

I'm using

  • Windows 10
  • Python 3.9.6.
  • Newest ManimGL (cloned from this GitHub)
  • basic MikTex (6/8/2021)
  • all other necessary things (ffmpeg etc.)

SlPandor avatar Aug 12 '21 20:08 SlPandor

I just solved this problem. Configure the yml file c:\users\Ab\manim\manimlib\default_config.yml that you reported error and add an absolute path to ”directories“.

DaisyEavan avatar Oct 15 '21 04:10 DaisyEavan

中文

Windows解决方案

  • 1.在C盘创建TempLatex(具体什么名字按你的喜好来)目录
  • 2.在manim(manimgl版本)目录中找到manimlib/default_config.yml并使用文本编辑器打开
  • 3.修改第18行 之前:temporary_storage: "" 之后:temporary_storage: "C:/TempLatex"
  • 4.保存

English

Windows Solution

  • 1.Create TempLatex directory in C drive
  • 2.Find manimlib/default_config.yml in the manim (manimgl version) directory and open it with a text editor
  • 3.Modify line 18: before: temporary_storage: "" after: temporary_storage: "C:/TempLatex "
  • 4.Save

longlongvip avatar Dec 17 '21 09:12 longlongvip

中文

Windows解决方案

* 1.在C盘创建TempLatex(具体什么名字按你的喜好来)目录

* 2.在manim(manimgl版本)目录中找到manimlib/default_config.yml并使用文本编辑器打开

* 3.修改第18行 之前:**temporary_storage: ""** 之后:**temporary_storage: "C:/TempLatex"**

* 4.保存

English

Windows Solution

* 1.Create TempLatex directory in C drive

* 2.Find manimlib/default_config.yml in the manim (manimgl version) directory and open it with a text editor

* 3.Modify line 18: before: **temporary_storage: ""** after: **temporary_storage: "C:/TempLatex "**

* 4.Save

Very good. It solved the problem.

Junetea avatar Jan 29 '22 11:01 Junetea

https://github.com/3b1b/manim/issues/1606#issuecomment-1024893343

After I changed the default_ config. yml, the system reported an error. 'manimgl' is not recognized as an internal or external command,operable program or batch file. when I use pip install manimgl,the system said: 'pip' is not recognized as an internal or external command, operable program or batch file.

ghost avatar Apr 05 '22 03:04 ghost

Hey everyone! If your system reported an error after you changed the default_ config. yml,you should use Path.

ghost avatar Apr 05 '22 04:04 ghost

But... 'latex' is not recognized as an internal or external command, operable program or batch file. ERROR LaTeX Error! Not a worry, it happens to the best of us. tex_file_writing.py:90 Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310-32\Scripts\manimgl-script.py", line 33, in sys.exit(load_entry_point('manimgl', 'console_scripts', 'manimgl')()) File "c:\manim-master\manimlib_main_.py", line 25, in main scene.run() File "c:\manim-master\manimlib\scene\scene.py", line 80, in run self.construct() File "C:\manim-master\vscode\Example.py", line 5, in construct tex = Tex(r'\sin^{n}x') File "c:\manim-master\manimlib\mobject\svg\tex_mobject.py", line 170, in init super().init(full_string, **kwargs) File "c:\manim-master\manimlib\mobject\svg\tex_mobject.py", line 39, in init super().init(**kwargs) File "c:\manim-master\manimlib\mobject\svg\svg_mobject.py", line 62, in init self.init_svg_mobject() File "c:\manim-master\manimlib\mobject\svg\svg_mobject.py", line 73, in init_svg_mobject self.generate_mobject() File "c:\manim-master\manimlib\mobject\svg\svg_mobject.py", line 88, in generate_mobject file_path = self.get_file_path() File "c:\manim-master\manimlib\mobject\svg\tex_mobject.py", line 60, in get_file_path file_path = tex_to_svg_file(full_tex) File "c:\manim-master\manimlib\utils\tex_file_writing.py", line 52, in tex_to_svg_file tex_to_svg(tex_file_content, svg_file) File "c:\manim-master\manimlib\utils\tex_file_writing.py", line 60, in tex_to_svg svg_file = dvi_to_svg(tex_to_dvi(tex_file)) File "c:\manim-master\manimlib\utils\tex_file_writing.py", line 91, in tex_to_dvi with open(log_file, "r", encoding="utf-8") as file: FileNotFoundError: [Errno 2] No such file or directory: 'C:\TempLaTeX\Tex\7080b415f16710a7.log'

ghost avatar Apr 05 '22 04:04 ghost

'latex' is not recognized as an internal or external command,

notice 'latex' is not recognized as an internal or external command, that means you haven't installed LaTeX properly.

TonyCrane avatar Apr 05 '22 07:04 TonyCrane

@TonyCrane Thanks.

ghost avatar Apr 05 '22 08:04 ghost