I am trying to run this line of code to generate a report using pylatex:
doc.generate_pdf(report_name, clean_tex=True)
This works well to generate a pdf file without any error when I use Spyder and Jupyter Notebook to execute the program, but when I try to use Crontab to automate my task by executing the exact same py file every day,
0 6 * * * cd /Users/me/my_folder && /anaconda3/bin/python3 MyProgram.py
the following error occurs via terminal mail:
Traceback (most recent call last):
File "MyProgram.py", line 255
doc.generate_pdf(report_name, clean_tex=True)
File "/anaconda3/lib/python3.7/site-packages/pylatex/document.py", line 299, in generate_pdf
'No LaTex compiler was found\n'
pylatex.errors.CompilerError: No LaTex compiler was found
Either specify a LaTex compiler or make sure you have latexmk or pdfLaTex installed.
I have spent hours searching for solutions online but still cannot fix the bug. So I would like to get some help. Thanks in advance.