1

Apologies if a similar question has been posted elsewhere. I'm trying to switch to Python for typesetting new projects but find the setup quite difficult. For this I've come across PyLatex, which looks promising I've followed the setup instructions via pip, installed LatexMK, and tried to execute the basic example file to test it. This failed, throwing the following error at me:

runfile('/Users/~/.spyder-py3/untitled0.py', wdir='/Users/~/.spyder-py3')
Latexmk: This is Latexmk, John Collins, 17 Jan. 2018, version: 4.55.
Rule 'pdflatex': File changes, etc:
   Non-existent destination files:
      'basic.pdf'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex  --interaction=nonstopmode -recorder  "basic.tex"'
------------
Latexmk: applying rule 'pdflatex'...
sh: pdflatex: command not found
Collected error summary (may duplicate other messages):
  pdflatex: (Pdf)LaTeX failed to generate the expected log file 'basic.log'
Latexmk: Did not finish processing file 'basic.tex':
   (Pdf)LaTeX failed to generate the expected log file 'basic.log'
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs of latex/pdflatex.
Latexmk: Errors, so I did not complete making targets

Traceback (most recent call last):

  File "<ipython-input-24-35bb0f8240b1>", line 1, in <module>
    runfile('/Users/~/.spyder-py3/untitled0.py', wdir='/Users/~/.spyder-py3')

  File "/Users/~/opt/anaconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "/Users/~/opt/anaconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/Users/~/.spyder-py3/untitled0.py", line 32, in <module>
    doc.generate_pdf(clean_tex=False)

  File "/Users/~/opt/anaconda3/lib/python3.7/site-packages/pylatex/document.py", line 233, in generate_pdf
    stderr=subprocess.STDOUT)

  File "/Users/~/opt/anaconda3/lib/python3.7/subprocess.py", line 395, in check_output
    **kwargs).stdout

  File "/Users/~/opt/anaconda3/lib/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)

CalledProcessError: Command '['latexmk', '--pdf', '--interaction=nonstopmode', 'basic.tex']' returned non-zero exit status 12.

I'm using an Anaconda environment with Python 3.7 on Mac (OS 10.15.4). What I was hoping to achieve was to create a latex file and generate a pdf as I would normally with Latex.

Thanks for any help!

Paul
  • 23
  • 2

0 Answers0