manim icon indicating copy to clipboard operation
manim copied to clipboard

latex: command not found}{c}\quad \\\quad \\\end{array}\right]

Open ppamorim opened this issue 3 years ago • 13 comments

Describe the bug

The display of example scene went wrong while running. Tex File doesn't exist.

Code:

  1. Clone the repo
  2. cd into and pip install -e .
  3. manimgl example_scenes.py OpeningManimExample as described in the README

Wrong display or Error traceback:

MacBook-Pro:manim ppamorim$ manimgl example_scenes.py OpeningManimExample
ManimGL v1.2.0
[02:01:09] INFO     Using the default configuration file, which    config.py:231
                    you can modify in `/Users/ppamorim/Repository/              
                    manim/manimlib/default_config.yml`                          
           INFO     If you want to create a local configuration    config.py:232
                    file, you can create a file named                           
                    `custom_config.yml`, or run `manimgl --config`              
2021-10-24 02:01:10.115 Python[85523:5352478] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/dj/m6vp0jsx1r76hcjg4w3p_gq40000gp/T/org.python.python.savedState
sh: latex: command not found}{c}\quad \\\quad \\\end{array}\right]"             
[02:01:14] ERROR    LaTeX Error!  Not a worry, it happens tex_file_writing.py:90
                    to the best of us.                                          
Traceback (most recent call last):                                 
  File "/usr/local/bin/manimgl", line 33, in <module>
    sys.exit(load_entry_point('manimgl', 'console_scripts', 'manimgl')())
  File "/Users/ppamorim/Repository/manim/manimlib/__main__.py", line 25, in main
    scene.run()
  File "/Users/ppamorim/Repository/manim/manimlib/scene/scene.py", line 76, in run
    self.construct()
  File "example_scenes.py", line 29, in construct
    IntegerMatrix(matrix, include_background_rectangle=True),
  File "/Users/ppamorim/Repository/manim/manimlib/mobject/matrix.py", line 81, in __init__
    self.add_brackets()
  File "/Users/ppamorim/Repository/manim/manimlib/mobject/matrix.py", line 111, in add_brackets
    bracket_pair = Tex("".join([
  File "/Users/ppamorim/Repository/manim/manimlib/mobject/svg/tex_mobject.py", line 162, in __init__
    super().__init__(full_string, **kwargs)
  File "/Users/ppamorim/Repository/manim/manimlib/mobject/svg/tex_mobject.py", line 41, in __init__
    filename = tex_to_svg_file(full_tex)
  File "/Users/ppamorim/Repository/manim/manimlib/utils/tex_file_writing.py", line 52, in tex_to_svg_file
    tex_to_svg(tex_file_content, svg_file)
  File "/Users/ppamorim/Repository/manim/manimlib/utils/tex_file_writing.py", line 60, in tex_to_svg
    svg_file = dvi_to_svg(tex_to_dvi(tex_file))
  File "/Users/ppamorim/Repository/manim/manimlib/utils/tex_file_writing.py", line 91, in tex_to_dvi
    with open(log_file, "r") as file:
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/dj/m6vp0jsx1r76hcjg4w3p_gq40000gp/T/Tex/c3372cf5b2620435.log'

Additional context

MacOS Big Sur, MBP M1 manim version: master python version: 3.9.7

ppamorim avatar Oct 24 '21 01:10 ppamorim

Have you installed LaTeX properly? Because your shell told you that sh: latex: command not found.

TonyCrane avatar Oct 24 '21 13:10 TonyCrane

@TonyCrane Yes it's installed.

Screenshot 2021-10-24 at 18 35 00

ppamorim avatar Oct 24 '21 17:10 ppamorim

try running latex --version ?

TonyCrane avatar Oct 25 '21 10:10 TonyCrane

MacBook-Pro:t-pro-ios ppamorim$ latex --version
-bash: latex: command not found

So mactex is installed but I can't use it. I am running this on a M1 machine.

ppamorim avatar Oct 25 '21 15:10 ppamorim

I have the same problem, solved by adding LaTex to the environment variable

node-rookie avatar Nov 02 '21 07:11 node-rookie

Hi @TonyCrane ,

Would you mind to help me to take a look at this issue? The .tex file was generated by manimlib, and here is the err log

This is TeX, Version 3.14159265 (TeX Live 2019/Debian) (preloaded format=tex)
(./Tex/e4d7da810f12ab27.tex
! Undefined control sequence.
l.1 \documentclass
                  [preview]{standalone}
? 
! Undefined control sequence.
l.3 \usepackage
               [english]{babel}
? 
! Undefined control sequence.
l.4 \usepackage
               [utf8]{inputenc}
? 
! Undefined control sequence.
l.5 \usepackage
               [T1]{fontenc}

This is my tex version on Ubuntu 20.04

pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian)
kpathsea version 6.3.1
Copyright 2019 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.01

Run manim-render got err :

           INFO     If you want to create a local configuration file, you can  config.py:232
                    create a file named `custom_config.yml`, or run `manimgl                
                    --config`                                                               
 Writing "\lim_{n \to \infty} \left\lfloor \sqrt{\frac{1}{n !} \mathrm{e}^{n} a_{n} + b_{n}^{p}} \otimes \sqrt[n]{\sum_{m = 0}^{n^{2}} \tilde{c}_{m \cdot n}^{b_{n}^{p} \cos \left( \the           ERROR    LaTeX Error!  Not a worry, it happens to the best tex_file_writing.py:90
                    of us.                                                                  
           DEBUG    The error could be: `Undefined control sequence.` tex_file_writing.py:94
               

Thanks.

gxshao avatar Nov 17 '21 05:11 gxshao

@gxshao Your problem has nothing to do with this issue, so please open a new issue to explain your problem, and please paste your code.

TonyCrane avatar Nov 17 '21 11:11 TonyCrane

中文

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

@TonyCrane brew install mactex, where to find latex command?

gamelife1314 avatar Dec 27 '21 15:12 gamelife1314

The reason behind this exception is because the temporary directory in windows contains a ~ which for some reason breaks something (some internal logic of the library, or character encoding limitation)

So you can fix by setting up a new directory inside custom_config.yml:

# I use the D: drive but this can be any folder from any drive
# Just make sure to contains only alpha characters (a-zA-Z)
directories:
  temporary_storage: D:\TempStorage # Must exists and should be an empty folder

alexrintt avatar Apr 10 '22 22:04 alexrintt

I have the same problem, solved by adding LaTex to the environment variable.

export PATH="/usr/local/texlive/2022/bin/universal-darwin:$PATH"

The reason is the MacTeX installer not update the environment variable automatically.

vtnil avatar Nov 02 '22 04:11 vtnil

For 2023 it's export PATH="/usr/local/texlive/2023/bin/universal-darwin:$PATH"

technixp avatar Jul 15 '23 09:07 technixp