Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyLatex basic script won't run because script interpreter could not be found

Tags:

python

I'm trying to learn PyLatex. I've installed it via pip and copied the basic code from here and I'm getting this issue:

C:\Conner\Scripts>pylatAttempt.py
latexmk: The script interpreter could not be found.
latexmk: Data: scriptInterpreter="perl.exe"
Traceback (most recent call last):
File "C:\Conner\Scripts\pylatAttempt.py", line 23, in <module>doc.generate_pdf()
File "C:\Python27\ArcGIS10.2\lib\site-packages\pylatex\document.py", line 193, in generate_pdf raise(e) 
subprocess.CalledProcessError: Command '[u'latexmk', u'--pdf', u'--interaction=nonstopmode', u'basic.tex']' returned non-zero exit status 1

I've downloaded MiKTeX 2.9, do I need anything else? What is going wrong here? From the docs it seems like all you need to install is pylatex.

like image 876
Conner Leverett Avatar asked Apr 11 '16 22:04

Conner Leverett


2 Answers

You can change the compiler to pdflatex instead of latexmk which will work if you have installed miktex and pdflatex . latexmk is compiler by default.

doc.generate_pdf(clean_tex=False,compiler='pdfLaTeX')
like image 102
Rohan Nayak Avatar answered Oct 22 '22 06:10

Rohan Nayak


If anyone stumbles upon this it turns out that for PyLatex to work you also have to have Perl installed. Once I downloaded Perl from here it worked. Make sure Perl is in the PATH.

like image 41
Conner Leverett Avatar answered Oct 22 '22 06:10

Conner Leverett