如何修复:Jupyter PDF 导出 PNG降价包含失败

问题描述

更新结束

经过极其痛苦的更新过程,主要是因为 PDF 导出使用 XeLaTeX 而我一直更喜欢 LaTeX,因此需要不同的包)...

(重要的是:我认为 pandoc 希望在包 MS 中找到 everyshi.sty,但是 as reported on CTAN 它不再在那个包中)

PDF 创建失败,来自服务器的此信息:

notebook.tex:1678: Unable to load picture or PDF file '
dvipdfmx:fatal: Image inclusion Failed for "attachment:9e002d53-d7a5-42e1-8b51-0fdec8f4dad5.png".
No output PDF file written.

Sorry,but xelatex did not succeed.
    The log file hopefully contains the information to get MiKTeX going again:
      C:\Users\usernamehere\AppData\Local\MiKTeX\2.9\miktex\log\xelatex.log

xelatax.log 显示

2021-06-10 08:02:26,620+0100 INFO  xelatex.core - start process: miktex-dvipdfmx.exe --miktex-enable-installer -q -E -o notebook.pdf
2021-06-10 08:02:28,594+0100 FATAL xelatex.core - Invalid argument
2021-06-10 08:02:28,594+0100 FATAL xelatex.core - Function: fwrite
2021-06-10 08:02:28,594+0100 FATAL xelatex.core - Result: 22
2021-06-10 08:02:28,594+0100 FATAL xelatex.core - Data: <no data>
2021-06-10 08:02:28,594+0100 FATAL xelatex.core - Source: Libraries\MiKTeX\TeXAndFriends\include\miktex/C4P/C4P.h:646
2021-06-10 08:02:28,594+0100 FATAL xelatex - Invalid argument
2021-06-10 08:02:28,594+0100 FATAL xelatex - Info: 
2021-06-10 08:02:28,594+0100 FATAL xelatex - Source: Libraries\MiKTeX\TeXAndFriends\include\miktex/C4P/C4P.h
2021-06-10 08:02:28,594+0100 FATAL xelatex - Line: 646
2021-06-10 08:02:28,596+0100 INFO  xelatex - this process (37528) finishes with exit code 1

然后如果我们查看 miktex-dvipdfmx.log,我们会发现调用的另一端...

2021-06-10 08:02:26,808+0100 INFO  miktex-dvipdfmx - this process (4364) started by 'xelatex' with command line: miktex-dvipdfmx.exe --miktex-enable-installer -q -E -o notebook.pdf
2021-06-10 08:02:28,558+0100 ERROR miktex-dvipdfmx - Image inclusion Failed for "attachment:9e002d53-d7a5-42e1-8b51-0fdec8f4dad5.png".
2021-06-10 08:02:28,559+0100 INFO  miktex-dvipdfmx - this process (4364) finishes with exit code 1

所以。 png 图像包含失败,它是降价单元格中的附件(先前输出的屏幕抓取,因此不必总是重新运行长时间运行的代码)。

任何人都可以确认这应该有效(我在很久以前看到过一些东西,在某个地方,markdown 单元格中的图像存在问题)如果是这样,请解释如何解决这个问题问题?

更新 I 29/06/2021

来自 xelatex 日志:有一个“无效参数消息”,上面的参数“-q -E -o”是针对 miktex-dvipdfmx.exe,但指的是 dvipdfmx manual 我找不到-q,-o 参数...

然后检查 BASIC manual for dvipddf () 和选项,其中 -o 是输出文件名(并不奇怪)但仍然没有 -q 选项的迹象。

那至少是一致的,但是……什么?如何?等等等等等等

2021 年 6 月 29 日更新二

更新了miktex;发现一个新项目,miktex-dvipdfmx-bin-x64-2,已经安装了!重新运行笔记本导出。不同的错误

nbconvert Failed: PDF creating Failed,captured latex output:
Failed to run "xelatex notebook.tex -quiet" command:

notebook.tex:561: Undefined control sequence

检查我找到的 miktex-dvipdfmx.log

2021-06-10 08:02:26,559+0100 INFO  miktex-dvipdfmx - this process (4364) finishes with exit code 1

所以参数错误(大概)是通过使用 miktex-dvipdfmx-bin-x64-2 解决的,现在 tex 本身还有一些其他问题

不幸的是,对 C:\ 和单独的文档驱动器进行全面搜索未能找到 notebook.tex,因此调查在这里陷入了死胡同。

但是,请注意,PDF 导出对于没有嵌入“附件”的笔记本可以正常工作 - 我想知道它是否根本找不到附件“文件

来自 jupyter 的最终错误报告为 500 服务器错误

nbconvert Failed: PDF creating Failed,captured latex output:
Failed to run "xelatex notebook.tex -quiet" command:

notebook.tex:496: Undefined control sequence [17 times]
...
notebook.tex:2119: Unable to load picture or PDF file '
dvipdfmx:fatal: Image inclusion Failed for "attachment:9e002d53-d7a5-42e1-8b51-0fdec8f4dad5.png".

No output PDF file written.

Sorry,but xelatex did not succeed.

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

  C:\Users\Julian\AppData\Local\MiKTeX\2.9\miktex\log\xelatex.log

然后 xelatex 日志说没有数据

2021-06-29 08:30:42,590+0100 INFO  xelatex.core - start process: miktex-dvipdfmx.exe --miktex-enable-installer -q -E -o notebook.pdf
2021-06-29 08:30:43,984+0100 FATAL xelatex.core - Invalid argument
2021-06-29 08:30:43,984+0100 FATAL xelatex.core - Function: fwrite
2021-06-29 08:30:43,984+0100 FATAL xelatex.core - Result: 22
2021-06-29 08:30:43,984+0100 FATAL xelatex.core - Data: <no data>
2021-06-29 08:30:43,984+0100 FATAL xelatex.core - Source: Libraries\MiKTeX\TeXAndFriends\include\miktex/C4P/C4P.h:646
2021-06-29 08:30:43,984+0100 FATAL xelatex - Invalid argument
2021-06-29 08:30:43,984+0100 FATAL xelatex - Info: 
2021-06-29 08:30:43,984+0100 FATAL xelatex - Source: Libraries\MiKTeX\TeXAndFriends\include\miktex/C4P/C4P.h
2021-06-29 08:30:43,984+0100 FATAL xelatex - Line: 646
2021-06-29 08:30:43,986+0100 INFO  xelatex - this process (38968) finishes with exit code 1

可能相关:github nbconvert issues

解决方法

我在这里也遇到了同样的问题。现在我的临时解决方案是使用Chrome浏览器的打印功能(另存为pdf),但是标题部分和脚注看起来很鸡肋和烦人。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...