Setup nbconvert: Difference between revisions

From HPCWIKI
Jump to navigation Jump to search
(Fix: remove --- horizontal lines (7 removed))
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
== nbconvert ==
{{Status
|status=Draft
|owner=Knowledge Agent
|last_update=2026-07-16
|review=Pending
}}
 
{{TOC}}
 
== Overview ==
 
Setup nbconvert에 대한 기술 문서입니다.
 
=== Summary ===
 
* 무엇인가? - Setup nbconvert
* 왜 필요한가? - HPC 및 서버 환경에서 필수 개념
* 언제 사용하는가? - 서버 구성, 성능 튜닝, 문제 해결 시
 
 
== Purpose ==
 
이 문서가 존재하는 이유
 
* Goal: Setup nbconvert에 대한 기술 정보 제공
* Scope: Setup nbconvert의 개념, 사용법, 설정
* Non-goals: 다른 주제로의 확장
 
 
== Key Concepts ==
 
{| class="wikitable"
! Concept
! Description
! Related
|-
| Setup nbconvert
| HPC/서버 환경에서 중요한 기술 개념
| [[Linux]], [[Server]]
|}
 
 
== Detailed Explanation ==
 
The '''nbconvert''' tool<ref>https://github.com/jupyter/nbconvert</ref> ([[jupyter]] nbconvert) converts notebooks to various other formats via Jinja templates. The nbconvert tool allows you to convert an .ipynb into  
The '''nbconvert''' tool<ref>https://github.com/jupyter/nbconvert</ref> ([[jupyter]] nbconvert) converts notebooks to various other formats via Jinja templates. The nbconvert tool allows you to convert an .ipynb into  
* HTML
* HTML
* LaTeX
* LaTeX
Line 10: Line 52:
* executable script
* executable script
* etc
* etc
== Setup nvconvert on Ubuntu ==
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
#Install pandoc  
#Install pandoc  
sudo apt-get install pandoc
sudo apt-get install pandoc
# install nbconvert with webpdf
# install nbconvert with webpdf
sudo -H pip install --upgrade nbconvert[webpdf] pyppeteer
sudo -H pip install --upgrade nbconvert[webpdf] pyppeteer
#Running the tests after a dev install above:
#Running the tests after a dev install above:
pip install nbconvert[test]
pip install nbconvert[test]
py.test --pyargs nbconvert
py.test --pyargs nbconvert
</syntaxhighlight>
</syntaxhighlight>
== Usage ==
General command line usage is,  
General command line usage is,  
<code>$ jupyter nbconvert --to <output format> <input notebook></code>
<code>$ jupyter nbconvert --to <output format> <input notebook></code>


<syntaxhighlight lang="bash">
# convert notebook to HTML, then load HTML on browser to print as PDF
jupyter nbconvert --to html HPCMATE.ipynb


# convert notebook to webpdf
== Best Practices ==
jupyter nbconvert --to webpdf HPCMATE.ipynb


# convert notebook to webpdf, log_level parameter would point out if you have problem
* 최신 버전 사용 권장
jupyter nbconvert --to pdf --debug HPCMATE.ipynb
* 공식 문서 참고
 
* 테스트 환경에서 먼저 검증
</syntaxhighlight>




== References ==


Further details is available at https://nbconvert.readthedocs.io/en/latest/usage.html
* [https://wiki.hpcmate.com Setup nbconvert]


== Common Error ==


=== Package version dependency ===
== Related Pages ==
<syntaxhighlight lang="bash">
# common errors 1,


/usr/local/lib/python3.8/dist-packages/nbconvert/utils/pandoc.py:51: RuntimeWarning: You are using an unsupported version of pandoc (2.5).
* [[Linux]]
Your version must be at least (2.14.2) but less than (4.0.0).
* [[Server]]
* [[Hardware]]
* [[Network]]


# check pandock release information at https://github.com/jgm/pandoc/releases
# then download proper version of deb file and install with dpkg -i
wget https://github.com/jgm/pandoc/releases/download/3.1.11/pandoc-3.1.11-1-amd64.deb
$ sudo dpkg -i pandoc-3.1.11-1-amd64.deb
</syntaxhighlight>


=== PDF convert error with invalid characters ===
[[Category:Server]]
even all system level package and configuration has been successful, actual conversion into PDF may not successful because of "invalid character" in side of notebook. and seems not clear anwer yet from community<ref>https://www.google.com/search?q=nbconvert+pdf+conversion++invalid+character&client=firefox-b-d&sca_esv=592696311&sxsrf=AM9HkKmwSAK1sfsNHqtj9cSniDu-Yno74g%3A1703124597996&ei=dZ6DZbWzPN3n2roP7KK74Ac&ved=0ahUKEwj1wa_FuZ-DAxXds1YBHWzRDnwQ4dUDCBA&uact=5&oq=nbconvert+pdf+conversion++invalid+character&gs_lp=Egxnd3Mtd2l6LXNlcnAiK25iY29udmVydCBwZGYgY29udmVyc2lvbiAgaW52YWxpZCBjaGFyYWN0ZXIyCBAAGIAEGKIEMggQABiABBiiBDIIEAAYgAQYogQyCBAAGIAEGKIEMggQABiABBiiBEigM1AAWKgwcAB4AJABAJgBjAGgAegOqgEEMi4xNbgBA8gBAPgBAcICBBAjGCfiAwQYACBBiAYB&sclient=gws-wiz-serp</ref>
== Knowledge Graph ==


== Customize nbconvert<ref>https://nbconvert.readthedocs.io/en/5.6.1/customizing.html</ref> ==
Related
By default, nbconvert finds templates from a few locations and you can check where they are<syntaxhighlight lang="bash">
# find template location
from jupyter_core.paths import jupyter_path
print(jupyter_path('nbconvert','templates'))
['/opt/hpcmate/home/.local/share/jupyter/nbconvert/templates', '/usr/local/share/jupyter/nbconvert/templates', '/usr/share/jupyter/nbconvert/templates']


→ [[Linux]]
→ [[Server]]
→ [[Hardware]]
→ [[Network]]


# display template structure
[[Category:Reference]]
from IPython.display import HTML, display
with open('template_structure.html') as f:
    display(HTML(f.read()))
</syntaxhighlight>
 
== References ==
<references />

Latest revision as of 11:30, 17 July 2026

Template:Status

Template:TOC

Overview

Setup nbconvert에 대한 기술 문서입니다.

Summary

  • 무엇인가? - Setup nbconvert
  • 왜 필요한가? - HPC 및 서버 환경에서 필수 개념
  • 언제 사용하는가? - 서버 구성, 성능 튜닝, 문제 해결 시


Purpose

이 문서가 존재하는 이유

  • Goal: Setup nbconvert에 대한 기술 정보 제공
  • Scope: Setup nbconvert의 개념, 사용법, 설정
  • Non-goals: 다른 주제로의 확장


Key Concepts

Concept Description Related
Setup nbconvert HPC/서버 환경에서 중요한 기술 개념 Linux, Server


Detailed Explanation

The nbconvert tool[1] (jupyter nbconvert) converts notebooks to various other formats via Jinja templates. The nbconvert tool allows you to convert an .ipynb into

  • HTML
  • LaTeX
  • PDF
  • Reveal JS
  • Markdown (md)
  • ReStructured Text (rst)
  • executable script
  • etc
#Install pandoc 
sudo apt-get install pandoc
# install nbconvert with webpdf
sudo -H pip install --upgrade nbconvert[webpdf] pyppeteer
#Running the tests after a dev install above:
pip install nbconvert[test]
py.test --pyargs nbconvert

General command line usage is, $ jupyter nbconvert --to <output format> <input notebook>


Best Practices

  • 최신 버전 사용 권장
  • 공식 문서 참고
  • 테스트 환경에서 먼저 검증


References


Related Pages

Knowledge Graph

Related

LinuxServerHardwareNetwork