[Python] Quarto cannot find nbformat and nbclient

Discussão em 'Python' iniciado por Stack, Junho 13, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to compile the following example (which uses the diagram filter):

    ---
    title: Test
    author:
    - John Due
    filters:
    - diagram
    format:
    beamer: default
    ---

    ## Test
    ```tikz
    \begin{tikzpicture}
    \node (i) at (0, 0) {i};
    \end{tikzpicture}
    ```


    but it fails. The problem seems to come from Jupyter (although I do not know why it is involved as I have no python code nor jupyter notebook) as it shows here:

    quarto check jupyter
    Quarto 1.7.31
    [✓] Checking Python 3 installation....OK
    Version: 3.12.3
    Path: /usr/bin/python3
    Jupyter: 5.3.2
    Kernels: python3

    (/) Checking Jupyter engine render....Traceback (most recent call last):
    File "/opt/quarto/share/jupyter/jupyter.py", line 21, in <module>
    from notebook import notebook_execute, RestartKernel
    File "/opt/quarto/share/jupyter/notebook.py", line 19, in <module>
    import nbformat
    ModuleNotFoundError: No module named 'nbformat'
    [✓] Checking Jupyter engine render....OK


    I tried to install the package nbformat as mentioned in this stackoverflow question. Running pipx list shows that it is installed in a virtual environment (does quarto have access to this?):

    pipx list
    venvs are in /home/John-Due/.local/share/pipx/venvs
    apps are exposed on your $PATH at /home/John-Due/.local/bin
    manual pages are exposed at /home/John-Due/.local/share/man
    package nbclient 0.10.2, installed using Python 3.12.3
    - jupyter-execute
    package nbformat 5.10.4, installed using Python 3.12.3
    - jupyter-trust
    package radian 0.6.15, installed using Python 3.12.3
    - radian


    I also ran quarto capabilities and it shows that nbformat and nbclients are not installed:

    quarto capabilities
    {
    "formats": [
    "html",
    "pdf",
    "docx",
    "odt",
    "pptx",
    "beamer",
    "revealjs",
    "gfm",
    "epub",
    "dashboard",
    "email",
    "ansi",
    "asciidoc",
    "asciidoc_legacy",
    "asciidoctor",
    "chunkedhtml",
    "commonmark",
    "commonmark_x",
    "context",
    "djot",
    "docbook",
    "docbook4",
    "docbook5",
    "dokuwiki",
    "dzslides",
    "epub2",
    "epub3",
    "fb2",
    "haddock",
    "html4",
    "html5",
    "icml",
    "ipynb",
    "jats",
    "jats_archiving",
    "jats_articleauthoring",
    "jats_publishing",
    "jira",
    "json",
    "latex",
    "man",
    "markdown",
    "markdown_github",
    "markdown_mmd",
    "markdown_phpextra",
    "markdown_strict",
    "markua",
    "mediawiki",
    "ms",
    "muse",
    "native",
    "opendocument",
    "opml",
    "org",
    "plain",
    "rst",
    "rtf",
    "s5",
    "slideous",
    "slidy",
    "tei",
    "texinfo",
    "textile",
    "typst",
    "xwiki",
    "zimwiki"
    ],
    "themes": [
    "default",
    "spacelab",
    "united",
    "morph",
    "materia",
    "sandstone",
    "cyborg",
    "slate",
    "superhero",
    "sketchy",
    "darkly",
    "lux",
    "vapor",
    "yeti",
    "cosmo",
    "litera",
    "flatly",
    "zephyr",
    "minty",
    "solar",
    "simplex",
    "lumen",
    "cerulean",
    "quartz",
    "pulse",
    "journal"
    ],
    "python": {
    "versionMajor": 3,
    "versionMinor": 12,
    "versionPatch": 3,
    "versionStr": "3.12.3 (main, Feb 4 2025, 14:48:35) [GCC 13.3.0]",
    "conda": false,
    "execPrefix": "/usr",
    "executable": "/usr/bin/python3",
    "jupyter_core": "5.3.2",
    "nbformat": null,
    "nbclient": null,
    "ipykernel": null,
    "shiny": null,
    "pyLauncher": false,
    "kernels": [
    {
    "name": "python3",
    "language": "python",
    "display_name": "Python 3 (ipykernel)",
    "path": "/home/John-Due/.local/share/jupyter/kernels/python3"
    }
    ],
    "venv": true
    }
    }%


    Any idea on how to solve this problem?

    In case of, here is the error returned in the shell:

    ** (org.inkscape.Inkscape:20806): WARNING **: 12:04:31.085: No pages selected, getting first page only.
    Error running filter /opt/quarto/share/filters/main.lua:
    string expected, got nil
    while retrieving function argument root
    while retrieving arguments for function make_relative
    stack traceback:
    .../share/pandoc/datadir/../../filters/modules/mediabag.lua:20: in function 'modules/mediabag.with_mediabag_contents'
    (...tail calls...)
    /opt/quarto/share/filters/main.lua:2943: in local 'fn'
    ...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:34: in upvalue 'run_filter_function'
    ...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:223: in function <...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:202>
    (...tail calls...)
    [C]: in function 'pandoc.List.map'
    ...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:125: in upvalue 'recurse'
    ...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:222: in local 'jogger'
    ...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:98: in upvalue 'recurse'
    ...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:222: in function <...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:202>
    (...tail calls...)
    [C]: in function 'pandoc.List.map'
    ...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:125: in upvalue 'recurse'
    ...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:222: in local 'jogger'
    ...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:171: in upvalue 'recurse'
    ...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:222: in function <...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:202>
    (...tail calls...)
    /opt/quarto/share/filters/main.lua:572: in function </opt/quarto/share/filters/main.lua:550>
    (...tail calls...)
    /opt/quarto/share/filters/main.lua:1318: in local 'callback'
    /opt/quarto/share/filters/main.lua:1336: in upvalue 'run_emulated_filter_chain'
    /opt/quarto/share/filters/main.lua:1372: in function </opt/quarto/share/filters/main.lua:1369>


    I know it does not mention the python stuff discussed above, but I started to have the ModuleNotFoundError: No module named 'nbformat' problem first.

    Continue reading...

Compartilhe esta Página