jupyter / nbconvert

Jupyter Notebook Conversion
https://nbconvert.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.75k stars 568 forks source link

Jupyter notebook -> pdf error #1099

Open sheerakm opened 5 years ago

sheerakm commented 5 years ago

I am unable to generate a pdf from my notebook. I get the following error. 500 : Internal Server Error The error was: nbconvert failed: PDF creating failed, captured latex output: Failed to run "xelatex .\notebook.tex -quiet" command:

^^@:4: Emergency stop

ps: tried removing the '.' from pdf.py

MSeal commented 5 years ago

Can you post the notebook in question and the version of nbconvert your are using (I'd recommend testing this again with 5.6)?

Also try running with --Application.log_level=10 so we can get full logs of the failure.

krinkere commented 5 years ago

Same here

`nbconvert failed: PDF creating failed, captured latex output: Failed to run "['xelatex', './notebook.tex', '-quiet']" command: This is XeTeX, Version 3.1415926-2.5-0.9999.3 (TeX Live 2013) restricted \write18 enabled. entering extended mode (./notebook.tex LaTeX2e <2011/06/27> Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo aded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo))

! LaTeX Error: File `tcolorbox.sty' not found.

Type X to quit or to proceed, or enter new name. (Default extension: sty)

Enter file name: ! Emergency stop. <read *>

l.4 \usepackage {parskip} % Stop auto-indenting (to mimic markdown behavi...

No pages of output. Transcript written on notebook.log.`

t-makaro commented 5 years ago

@krinkere You'll need to install some extra latex packages. It looks like you need the tcolorbox package, but you may need others.

wish1832 commented 5 years ago

I'm having the same issue with a different log (see below). My nbconvert version is 5.6.1.

[I 00:38:38.850 NotebookApp] Building PDF [I 00:38:38.860 NotebookApp] Running xelatex 3 times: ['xelatex', '.\notebook.tex', '-quiet'] [C 00:38:40.330 NotebookApp] x failed: xelatex .\notebook.tex -quiet ^^@:104: Emergency stop [E 00:38:40.332 NotebookApp] nbconvert failed: PDF creating failed, captured latex output: Failed to run "xelatex .\notebook.tex -quiet" command:

^^@:104: Emergency stop
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\sklearn22dev\lib\site-packages\notebook\nbconvert\handlers.py", line 130, in get
    resources=resource_dict
  File "C:\ProgramData\Anaconda3\envs\sklearn22dev\lib\site-packages\nbconvert\exporters\pdf.py", line 185, in from_notebook_node
    self.run_latex(tex_file)
  File "C:\ProgramData\Anaconda3\envs\sklearn22dev\lib\site-packages\nbconvert\exporters\pdf.py", line 156, in run_latex
    self.latex_count, log_error, raise_on_failure)
  File "C:\ProgramData\Anaconda3\envs\sklearn22dev\lib\site-packages\nbconvert\exporters\pdf.py", line 145, in run_command
    command=command, output=out))
nbconvert.exporters.pdf.LatexFailed: PDF creating failed, captured latex output:
Failed to run "xelatex .\notebook.tex -quiet" command:

^^@:104: Emergency stop

[W 00:38:40.334 NotebookApp] 500 GET /nbconvert/pdf/Dropbox/Udemy_Courses/Machine_Learning_A_to_Z/Data_Sets/Part%209%20-%20Dimensionality%20Reduction/Section%2043%20-%20Principal%20Component%20Analysis%20(PCA)/Udemy-%20PCA.ipynb?download=true (::1): nbconvert failed: PDF creating failed, captured latex output: Failed to run "xelatex .\notebook.tex -quiet" command:

^^@:104: Emergency stop

[E 00:38:40.341 NotebookApp] { "Host": "localhost:8888", "Connection": "keep-alive", "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3", "Sec-Fetch-Site": "same-origin", "Sec-Fetch-Mode": "navigate", "Referer": "http://localhost:8888/notebooks/Dropbox/Udemy_Courses/Machine_Learning_A_to_Z/Data_Sets/Part%209%20-%20Dimensionality%20Reduction/Section%2043%20-%20Principal%20Component%20Analysis%20(PCA)/Udemy-%20PCA.ipynb", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "en-US,en;q=0.9", "Cookie": "_xsrf=2|1f138e91|e2413fa3a7e254151728fea8e69f215f|1573153079; username-localhost-8889=\"2|1:0|10:1574714173|23:username-localhost-8889|44:MGQ2YmU2ZWJlNmQyNDY5ZGE2YmY1MWIyOGI0ZTY0NGM=|173027981271f14c8752a19b418079d40fbf686239322dacae55a167ce02dbbb\"; username-localhost-8888=\"2|1:0|10:1574840247|23:username-localhost-8888|44:ZWViYWIzNjI2ZWUzNGQ2ZGJkYWNjOTFkNTJjZTNlYWE=|f80dfa680108386c834d15004a7ffe777a58870ee82935e594ef0500a29a36a9\"" } [E 00:38:40.346 NotebookApp] 500 GET /nbconvert/pdf/Dropbox/Udemy_Courses/Machine_Learning_A_to_Z/Data_Sets/Part%209%20-%20Dimensionality%20Reduction/Section%2043%20-%20Principal%20Component%20Analysis%20(PCA)/Udemy-%20PCA.ipynb?download=true (::1) 1950.53ms referer=http://localhost:8888/notebooks/Dropbox/Udemy_Courses/Machine_Learning_A_to_Z/Data_Sets/Part%209%20-%20Dimensionality%20Reduction/Section%2043%20-%20Principal%20Component%20Analysis%20(PCA)/Udemy-%20PCA.ipynb

AnyByte commented 4 years ago

Im also gettings the same error. The error log was too long for github, so I uploaded it to pastebin. error log

MSeal commented 4 years ago

from the nested logs @AnyByte It looks like MikTex is hard crashing:

Output written on B.2602gf (2 characters, 392 bytes).
Transcript written on B.log.
METAFONT failed for some reason

Sorry, but maketfm did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

  C:\Users\maxav\AppData\Local\MiKTeX\2.9\miktex\log\miktex-maketfm.log

You likely need to post those log files specifically, though given it's a hard crash inside miktex it may be an issue for the project specifically that nbconvert can't fix.

Gamecock commented 4 years ago

I am seeing the same issue. Even though it says Writing 32163 bytes to ./notebook.tex nothing is in the directory.


[NbConvertApp] Searching ['/home/ec2-user/SageMaker/AmazonSageMaker-UltimakerAnalysis', '/home/ec2-user/.jupyter', '/home/ec2-user/anaconda3/envs/JupyterSystemEnv/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[NbConvertApp] Looking for jupyter_config in /etc/jupyter
[NbConvertApp] Looking for jupyter_config in /usr/local/etc/jupyter
[NbConvertApp] Looking for jupyter_config in /home/ec2-user/anaconda3/envs/JupyterSystemEnv/etc/jupyter
[NbConvertApp] Looking for jupyter_config in /home/ec2-user/.jupyter
[NbConvertApp] Looking for jupyter_config in /home/ec2-user/SageMaker/AmazonSageMaker-UltimakerAnalysis
[NbConvertApp] Looking for jupyter_nbconvert_config in /etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /usr/local/etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /home/ec2-user/anaconda3/envs/JupyterSystemEnv/etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /home/ec2-user/.jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /home/ec2-user/SageMaker/AmazonSageMaker-UltimakerAnalysis
[NbConvertApp] Converting notebook UltimakerAnalysis.ipynb to pdf
[NbConvertApp] Notebook name is 'UltimakerAnalysis'
[NbConvertApp] Applying preprocessor: TagRemovePreprocessor
[NbConvertApp] Applying preprocessor: RegexRemovePreprocessor
[NbConvertApp] Applying preprocessor: coalesce_streams
[NbConvertApp] Applying preprocessor: SVG2PDFPreprocessor
[NbConvertApp] Applying preprocessor: LatexPreprocessor
[NbConvertApp] Applying preprocessor: HighlightMagicsPreprocessor
[NbConvertApp] Applying preprocessor: ExtractOutputPreprocessor
[NbConvertApp] Attempting to load template article.tplx
[NbConvertApp]     template_path: .
[NbConvertApp] Writing 32163 bytes to ./notebook.tex
[NbConvertApp] Building PDF
[NbConvertApp] Running xelatex 3 times: ['xelatex', './notebook.tex', '-quiet']
[NbConvertApp] CRITICAL | xelatex failed: ['xelatex', './notebook.tex', '-quiet']

Traceback (most recent call last):
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/bin/jupyter-nbconvert", line 11, in <module>
    sys.exit(main())
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/jupyter_core/application.py", line 268, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/nbconvert/nbconvertapp.py", line 340, in start
    self.convert_notebooks()
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/nbconvert/nbconvertapp.py", line 510, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/nbconvert/nbconvertapp.py", line 481, in convert_single_notebook
    output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/nbconvert/nbconvertapp.py", line 410, in export_single_notebook
    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/nbconvert/exporters/exporter.py", line 179, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/nbconvert/exporters/exporter.py", line 197, in from_file
    return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/nbconvert/exporters/pdf.py", line 185, in from_notebook_node
    self.run_latex(tex_file)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/nbconvert/exporters/pdf.py", line 156, in run_latex
    self.latex_count, log_error, raise_on_failure)
  File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/nbconvert/exporters/pdf.py", line 145, in run_command
    command=command, output=out))
nbconvert.exporters.pdf.LatexFailed: PDF creating failed, captured latex output:
Failed to run "['xelatex', './notebook.tex', '-quiet']" command:```
oltip commented 4 years ago

Hi guys,

I am running into the same issues. Has any of you solved it?

Gamecock commented 4 years ago

I was working in a Sagemaker Notebook, this issue resolved.

Jbdu4493 commented 4 years ago

Hi all, in fact we got this issue because some latex package is missing. To fix in the Temp directoty i search the file "notebook.tex" end i execute the file with MiKTeX. Miktex will download all needed package. and after it will be ok. Regards

yy1021805450 commented 4 years ago

I encountered the same error. I can convert some simple .ipynb files to pdf successfully .(there are only a few pages) But I can not convert .ipynb which contains many pages and the error above appeared . Does this mean that 'Nbconvert' can not convert complicated files ? I am confused.

MSeal commented 4 years ago

The xelatex conversion is rather particular on what it needs installed / passed to work. It's unlikely the length of the notebook and more some feature of the later sections that is failing to render. There's some planned work to help make attachments better but there's not much active development going on around making the debug experience here better. If you generate a latex output (the .tex extension you see referenced) and then try xelatex ./notebook.tex yourself without the -quiet and see if it says something more detailed about the error.

Brezel31 commented 4 years ago

Try to download as .tex file and remove following lines: " \usepackage{iftex} \ifPDFTeX \usepackage[T1]{fontenc} \usepackage{mathpazo} \else \usepackage{fontspec} \fi" now you should be able to run your tex-file with Miketex or what ever..

yy1021805450 commented 4 years ago

Thanks for advices @MSeal @Brezel31 . I have solved my problem by this: I compared the differences between the two ".ipynb" file . I found that I added a line "***" in markdown command to separate two lines . So the error above appeared when I converted it to pdf. However,when I removed this line"***" from the file, it worked. It can be transfered into pdf successfully. For markdown, the command like "***" means separating line and I think this is illegal for latex or pdf supported by texlive. So It worked when this command was deleted. In a word, do not use some "strange" commands that you hardly use in latex. That is my opinion.

WP-LKL commented 4 years ago
nbconvert failed: PDF creating failed, captured latex output:
Failed to run "xelatex .\notebook.tex -quiet" command:
This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019/W32TeX) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
! Undefined control sequence.
<*> .\notebook
              .tex -quiet
? 
! Emergency stop.
<*> .\notebook
              .tex -quiet
No pages of output.
Transcript written on ?.

The .tex document generated is correct and compilable (Atom: pdfTex).

It seems to be a compiling error, which can be easily circumnavigated.

No need to delete the things suggested by @Brezel31 in my case

MSeal commented 4 years ago

If someone wanted to open a PR to catch and translate these control character errors to something renderable before they crash xelatex I'd be happy to review the PR. I'm unlikely to get to fixing this myself for some time.

yuliaUU commented 4 years ago
nbconvert failed: PDF creating failed, captured latex output:
Failed to run "xelatex .\notebook.tex -quiet" command:
This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019/W32TeX) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
! Undefined control sequence.
<*> .\notebook
              .tex -quiet
? 
! Emergency stop.
<*> .\notebook
              .tex -quiet
No pages of output.
Transcript written on ?.

The .tex document generated is correct and compilable (Atom: pdfTex).

It seems to be a compiling error, which can be easily circumnavigated.

No need to delete the things suggested by @Brezel31 in my case

How can i solve this issue?

t-makaro commented 4 years ago

@yuliaUU Your issue has been fixed on master. It's caused by using TeX Live or some other version of LaTeX on Windows that was not originally intended for Windows. You can fix your issue by using the latest alpha of 6.0 of nbconvert or by switching to MikTeX.

yuliaUU commented 4 years ago

@t-makaro thank you!

May I ask you to write the commands 8 need to run? Sorry I am a bit new to all of this

Mathemilda commented 4 years ago

I have a similar error.


nbconvert failed: PDF creating failed, captured latex output:
Failed to run "xelatex .\notebook.tex -quiet" command:
This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020/W32TeX) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
! Undefined control sequence.
<*> .\notebook
              .tex -quiet
? 
! Emergency stop.
<*> .\notebook
              .tex -quiet
No pages of output.
Transcript written on ?.

I wonder if installation of R latex package has something to do with it, because it worked before and the R packages uses xelatex, too. Thanks for runaround going through .tex format, it worked for me.

Surdaster commented 4 years ago

In case it helps:

I had recently the same problem. I wrote a python program (version 3.7.6) in a jupyter notebook (version 6.0.3) and got the same error (Failed to run "xelatex .\notebook.tex -quiet" command) when I tried File / Download as / PDF via LateX.

Ultimately, the issue came from the fact that I introduced a Markdown cell in my notebook ! Keeping this cell, neither from jupyter notebook, nor from jupyter lab, I was able to download to PDF. Removing this cell, I now can use the PDF via Latex method from inside my jupyter notebook, and it works !

The problem seems to come from mixing Python and Markdown cells in the same notebook. Surprising...

MSeal commented 4 years ago

It's likely specific to some content in your markdown then. Can you post the markdown that caused the issue? I am guessing there's yet-another unescaped character that the LaTeX conversion tries to interpret.

Surdaster commented 4 years ago

Well, the code was simply taken from https://stackoverflow.com/questions/36288670/how-to-programmatically-generate-markdown-output-in-jupyter-notebooks:

from IPython.display import display, Markdown, Latex
display(Markdown('*some markdown* $\phi$'))
# If you particularly want to display maths, this is more direct:
display(Latex('\phi'))

I just re-imported this code in my notebook, and the command File / Download as / PDF via LateX (from inside my notebook) messed up again...

Funnear commented 4 years ago

Hello, I am new to LaTeX, working on Mac OS Catalina nbconvert version: 5.6.1

Notebook: https://github.com/Funnear/math_formulas/blob/master/Logarithms.ipynb

nbconvert failed: PDF creating failed, captured latex output:
Failed to run "['xelatex', './notebook.tex', '-quiet']" command:
This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./notebook.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06>
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/size11.clo))
(/usr/local/texlive/2020/texmf-dist/tex/latex/tcolorbox/tcolorbox.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/pgf/basiclayer/pgf.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.te
x
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-li
sts.tex))
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
(/usr/local/texlive/2020/texmf-dist/tex/latex/ms/everyshi.sty))
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/pgf.revision.tex)))
(/usr/local/texlive/2020/texmf-dist/tex/latex/pgf/basiclayer/pgfcore.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-def/xetex.def)))
(/usr/local/texlive/2020/texmf-dist/tex/latex/pgf/systemlayer/pgfsys.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.c
ode.tex))
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.de
f
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx
.def
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-p
df.def))))
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.
code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.
code.tex)) (/usr/local/texlive/2020/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-cfg/color.cfg))
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcore.code.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.
tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic
.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigo
nometric.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.rando
m.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.compa
rison.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.
code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round
.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.
code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integ
erarithmetics.code.tex)))
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex)
) (/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/math/pgfint.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.co
de.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathconst
ruct.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathusage
.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.co
de.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoregraphicst
ate.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransform
ations.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorequick.cod
e.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreobjects.c
ode.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepathproce
ssing.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.co
de.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.cod
e.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreimage.cod
e.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.
code.tex))
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorelayers.co
de.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretranspare
ncy.code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepatterns.
code.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/basiclayer/pgfcorerdf.code.
tex)))
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.cod
e.tex)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.
tex)
(/usr/local/texlive/2020/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
-0-65.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version
-1-18.sty)) (/usr/local/texlive/2020/texmf-dist/tex/latex/tools/verbatim.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/environ/environ.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/trimspaces/trimspaces.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/tcolorbox/tcbbreakable.code.tex
Library (tcolorbox): 'tcbbreakable.code.tex' version '4.22'
)) (/usr/local/texlive/2020/texmf-dist/tex/latex/parskip/parskip.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/kvoptions/kvoptions.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(/usr/local/texlive/2020/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty)))
(/usr/local/texlive/2020/texmf-dist/tex/generic/iftex/iftex.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-xdvipdfmx.def
))) (/usr/local/texlive/2020/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/fontenc.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/local/texlive/2020/texmf-dist/tex/latex/caption/caption.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/caption/caption3.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/adjustbox/adjustbox.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2020/texmf-dist/tex/generic/xkeyval/xkvutils.tex)))
(/usr/local/texlive/2020/texmf-dist/tex/latex/adjustbox/adjcalc.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/adjustbox/trimclip.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/collectbox/collectbox.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/adjustbox/tc-xetex.def))
(/usr/local/texlive/2020/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/varwidth/varwidth.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/float/float.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/tools/enumerate.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/iftex/ifvtex.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/textcomp.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/upquote/upquote.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/eurosym/eurosym.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/ucs/ucs.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/ucs/data/uni-global.def))
(/usr/local/texlive/2020/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/grffile/grffile.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/pdftexcmds/pdftexcmds.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/infwarerr/infwarerr.sty))
(/usr/local/texlive/2020/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty)
(/usr/local/texlive/2020/texmf-dist/tex/generic/pdfescape/pdfescape.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/hycolor/hycolor.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/auxhook/auxhook.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2020/texmf-dist/tex/generic/intcalc/intcalc.sty)
(/usr/local/texlive/2020/texmf-dist/tex/generic/etexcmds/etexcmds.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/url/url.sty)
(/usr/local/texlive/2020/texmf-dist/tex/generic/bitset/bitset.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty))
(/usr/local/texlive/2020/texmf-dist/tex/generic/atbegshi/atbegshi.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/hyperref/hxetex.def
(/usr/local/texlive/2020/texmf-dist/tex/latex/hyperref/puenc.def)
(/usr/local/texlive/2020/texmf-dist/tex/generic/stringenc/stringenc.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/atveryend/atveryend.sty)
(/usr/local/texlive/2020/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty
))) (/usr/local/texlive/2020/texmf-dist/tex/latex/titling/titling.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/tools/longtable.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/booktabs/booktabs.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/enumitem/enumitem.sty)
(/usr/local/texlive/2020/texmf-dist/tex/generic/ulem/ulem.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/jknapltx/mathrsfs.sty)
No file notebook.aux.
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/ts1cmr.fd)
ABD: EveryShipout initializing macros
(/usr/local/texlive/2020/texmf-dist/tex/latex/caption/ltcaption.sty)
*geometry* driver: auto-detecting
*geometry* detected driver: xetex
*geometry* verbose mode - [ preamble ] result:
* driver: xetex
* paper: <default>
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes: 
* h-part:(L,W,R)=(72.26999pt, 469.75502pt, 72.26999pt)
* v-part:(T,H,B)=(72.26999pt, 650.43001pt, 72.26999pt)
* \paperwidth=614.295pt
* \paperheight=794.96999pt
* \textwidth=469.75502pt
* \textheight=650.43001pt
* \oddsidemargin=0.0pt
* \evensidemargin=0.0pt
* \topmargin=-37.0pt
* \headheight=12.0pt
* \headsep=25.0pt
* \topskip=11.0pt
* \footskip=30.0pt
* \marginparwidth=59.0pt
* \marginparsep=10.0pt
* \columnsep=10.0pt
* \skip\footins=10.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidefalse
* \@mparswitchfalse
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)

(/usr/local/texlive/2020/texmf-dist/tex/latex/ucs/ucsencs.def)
(/usr/local/texlive/2020/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/refcount/refcount.sty)
(/usr/local/texlive/2020/texmf-dist/tex/generic/gettitlestring/gettitlestring.s
ty))

Package hyperref Warning: Rerun to get /PageLabels entry.

(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsb.fd)
(/usr/local/texlive/2020/texmf-dist/tex/latex/jknapltx/ursfs.fd)

LaTeX Warning: No \author given.

(/usr/local/texlive/2020/texmf-dist/tex/generic/stringenc/se-ascii-print.def)
! Missing $ inserted.
<inserted text> 
                $
l.380 ...abel{ab-given-b-0-a-0-a-1-means-a-_ab-b}}

? 
! Emergency stop.
<inserted text> 
                $
l.380 ...abel{ab-given-b-0-a-0-a-1-means-a-_ab-b}}

No pages of output.
Transcript written on notebook.log.
MSeal commented 4 years ago

Have you tried with 6.0.7? There's a lot of fixes in the 6.0 release though latex is still quite picky about some things that nbconvert doesn't catch well.

Funnear commented 4 years ago

Have you tried with 6.0.7? There's a lot of fixes in the 6.0 release though latex is still quite picky about some things that nbconvert doesn't catch well.

I have updated nbconvert to 6.0.7and tried again. I get the same error. But I look at Anaconda terminal log and see that error messages start with XeTeX in C mode:

xelatex failed: ['xelatex', 'notebook.tex', '-quiet']
    This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020) (preloaded format=xelatex)
     restricted \write18 enabled.
    entering extended mode
kslong commented 3 years ago

I just upgraded conda on my mac, and now I am encouthering an emergency stop on

ipython nbconvert --to pdf Split4.ipynb

with all of my scripts, all of which used to work. If I make a tex file with

ipython nbconvert --to latex Slit4.ipynb

I get a .tex file that works just fine using my normal latex tool.

Here is an example of the problem.

Split4.ipynb.txt

and the log when nbcovert to pdf is run goo.txt

and the pdf file that is produced if I run the conversion to latex only and then run my normal version of a latex processor

Split4.pdf

Addition: if I run xelatex on the .tex file that is produced, e.g

Split4.tex.txt

Then It encouters the error:

(/opt/sw/share/texmf-dist/tex/generic/oberdiek/se-ascii-print.def)

! Package pgfkeys Error: I do not know the key '/tcb/pad at break*', to which y
ou passed '1mm', and I am going to ignore it. Perhaps you misspelled it.

See the pgfkeys package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.387 ...back=cellbackground, colframe=cellborder]

but a quit command causes the routine to complete and produce a pdf file , so the issue seems to be some conbination of a problem with the tex file that is produced, and the not being able to handle the error.

alvazi2 commented 3 years ago

Had the same issue. Found that it was caused by a cell with Python code that I had switched to "Raw Data" cell type to prevent execution. When I switched the cell to "Markdown" cell type the export to PDF worked.

battalucar commented 3 years ago

I had the same problem it was because I typed LaTeX codes kinda wrong. I will write my problem, hope this helps.

$ x*2=x^2 $ --- This using is displaying in jupyter notebook but this is wrong and cannot convert a jupyter notebook file to PDF.

$x*2=x^2$ --- This using is correct and I solved by problem when I fixed it like this. You musn't use spaces between math code and $ signs.

danielalfonsetti commented 3 years ago

I had the same problem it was because I typed LaTeX codes kinda wrong. I will write my problem, hope this helps.

$ x*2=x^2 $ --- This using is displaying in jupyter notebook but this is wrong and cannot convert a jupyter notebook file to PDF.

$x*2=x^2$ --- This using is correct and I solved by problem when I fixed it like this. You musn't use spaces between math code and $ signs.

@battalucar This fixed my problem as well. Worth checking for other people who might run into this.

pjsandwich commented 3 years ago

I had a similar issue, I resolved this by first: pip install nbconvert --update, second: conda update --all, third: download and install latex (again) https://www.tug.org/texlive/acquire-netinstall.html, then start a new kernel before anything can run. The latex install will take some time.

I've seen people talking about tlmgr commands and configurations but this wasn't necessary for me. I ran this all on Windows 10 and obviously since my second step was to update everything in conda I was using the current version of everything which I would not recommend everyone do for future readers unless you're using a virtual env.

Good luck!

muhammedmostafa commented 3 years ago

nbconvert failed: PDF creating failed, captured latex output: Failed to run "xelatex notebook.tex -quiet" command: xelatex: warning: running with administrator privileges Sorry, but C:\anaconda3\Library\miktex\texmfs\install\miktex\bin\xelatex.exe did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

C:/Users/muhammed/AppData/Local/MiKTeX/2.9/miktex/log/xelatex.log

You may want to visit the MiKTeX project page, if you need help.

Sorry, but "MiKTeX Configuration Utility" did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

C:/Users/muhammed/AppData/Local/MiKTeX/2.9/miktex/log/initexmf.log

You may want to visit the MiKTeX project page, if you need help.

2021-04-27 22:27:55,129+0200 FATAL xelatex - The memory dump file could not be found. 2021-04-27 22:27:55,129+0200 FATAL xelatex - Info: fileName="xelatex.fmt" 2021-04-27 22:27:55,130+0200 FATAL xelatex - Source: Libraries\MiKTeX\TeXAndFriends\texmfapp.cpp 2021-04-27 22:27:55,130+0200 FATAL xelatex - Line: 690 2021-04-27 22:27:55,130+0200 INFO xelatex - finishing with exit code 1

tsungjung411 commented 3 years ago
500 : Internal Server Error
The error was:

nbconvert failed: PDF creating failed, captured latex output:
Failed to run "['xelatex', 'notebook.tex', '-quiet']" command:
This is XeTeX, Version 3.14159265-2.6-0.99992 (TeX Live 2015/Debian) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./notebook.tex
LaTeX2e <2016/02/01>
Babel <3.9q> and hyphenation patterns for 3 language(s) loaded.
...

I fixed this by (for Ubuntu)

sudo apt-get install texlive-generic-extra
Allow-tap commented 3 years ago

I encountered this problem by having a RawNBConvert cell begin with # character, when removed or turned to Markdown works fine!

guiffopaterne commented 3 years ago

I solved my problem sudo tlmgr install tcolorbox rsfs enumitem titling collectbox adjustbox ucs environ I install all the latex dependencies necessary to generate the pdf. here is some latex dependencies

powersurge8891 commented 2 years ago

LaTex fails to convert to PDF if your cells contain markdown codes.

RorisangSitoboli commented 2 years ago

Circumvent the problem. Save As 'html' then convert the .html (using the Print function) to pdf. Don't break your system over poorly organized packages.

Avral32 commented 1 year ago

Try to download it as Latex file and then open it with Tex Live and save as pdf.

shahrokh-bahtooei commented 1 year ago

The problem lies in some markdown text that could not render to LaTeX.

I believe, it is a good idea if the error we get points exactly to the problematic line in the notebook, which does not render with LaTeX. I hope it gets implemented in future 🙂

Till then, as a troubleshooting strategy, we can copy the notebook and eliminate big parts of the notebook while trying to convert it to PDF again and again so that—as the problem scope gets smaller and smaller—after several steps we'll finally find the exact place of the problem!

Mine was a link in the Table of Contents pointing to a markdown heading that had a % in the title :)) As we know this is a special character in URLs, I changed % to "Percent" in my title.

By the way, I seriously propose not giving up and finally finding the problem because the resulting PDF that LaTeX gives you is terrifically charming 🤩 Long lines of code are soft-wrapped to the next line, and table of content is automatically built via headings, neither of which is available to the PDF version generated from HTML 👀

henryleo180 commented 1 year ago

I had the same problem it was because I typed LaTeX codes kinda wrong. I will write my problem, hope this helps.

$ x*2=x^2 $ --- This using is displaying in jupyter notebook but this is wrong and cannot convert a jupyter notebook file to PDF.

x∗2=x2 --- This using is correct and I solved by problem when I fixed it like this. You musn't use spaces between math code and $ signs.

This works! For a long time, I had to save HTML and finally, I could save as PDF now

rebecaaras commented 1 year ago

Try to check MikTEX for updates, this will probably install the missing packages and let you PDF be generated.

AZFARHAD24511 commented 7 months ago

You probably used the image in your program and imported it from your computer in the Markdown cell. If you run and the image opens, you cannot convert your file to HTML or PDF. You can do this only if you import the image file but don't run it.