0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

vscodeで編集したjupyternotebookのexportエラー対処法

Last updated at Posted at 2022-12-31

事象

  • vscode上で編集したnotebookをPDFでexportしようとしたところ下記のエラーが発生。
> /opt/anaconda3/bin/python -m jupyter nbconvert /tmp/2039761f-2452-48f4-a2b9-fe06cfd385e4/work.1.ipynb --to pdf --output tmp-239FhAqS20h2565.html --output-dir /tmp --debug
error 12:46:37.424: Export failed [Error: [NbConvertApp] Searching ['/root/.vscode-server/bin/e8a3071ea4344d9d48ef8a4df2c097372b0c5161', '/root/.jupyter', '/opt/anaconda3/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 /opt/anaconda3/etc/jupyter
[NbConvertApp] Looking for jupyter_config in /root/.jupyter
[NbConvertApp] Looking for jupyter_config in /root/.vscode-server/bin/e8a3071ea4344d9d48ef8a4df2c097372b0c5161
[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 /opt/anaconda3/etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /root/.jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /root/.vscode-server/bin/e8a3071ea4344d9d48ef8a4df2c097372b0c5161
[NbConvertApp] Converting notebook /tmp/2039761f-2452-48f4-a2b9-fe06cfd385e4/work.1.ipynb to html
[NbConvertApp] Notebook name is 'tmp-239FhAqS20h2565'
[NbConvertApp] ERROR | Notebook JSON is invalid: Non-unique cell id '99b3287b-2872-4144-a7c1-e30e0ba29a5c' detected. Corrected to '93b153e5'.
〜〜〜中略〜〜〜
error 12:55:35.573: If you have not installed xelatex (TeX) you will need to do so before you can export to PDF, for further instructions please look https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex. 
To avoid installing xelatex (TeX) you might want to try exporting to HTML and using your browsers "Print to PDF" feature.

原因

  • 別のnotebookをコピーして編集していたことで、cell idがuniqueでなくなることが原因とのこと。

解消方法

  • 別のnotebookをコピーするのをやめるか、新しくnotebookを作成して、そこにコピペすることで解決する。

ソース

ハマったこと

  • PDFでexportしようとすると、以下のエラーでる。
error 12:55:35.573: If you have not installed xelatex (TeX) you will need to do so before you can export to PDF, for further instructions please look https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex. 
To avoid installing xelatex (TeX) you might want to try exporting to HTML and using your browsers "Print to PDF" feature.
  • xelatexのinstallを促されるので、再インストールしたりとめちゃくちゃハマった。
  • エラーをよく読めば、最初の方で'Notebook JSON is invalid: Non-unique cell id'が出てるので、最後のエラーと関係ないところを疑うべきで、落ち着いてエラー読もうねと思った。
  • issueはたてられてるようなので、最新バージョンでは解消しているかもしれない。

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?