mathworks/jupyter-matlab-proxy

Add support for notebook exports

Closed this issue · 1 comments

rsp34 commented

I tried to export a notebook as HTML and received the following error:

0:18:11.717 [info] Process Execution: ~\drive-designer\.venv\Scripts\python.exe -m jupyter nbconvert "c:\Users\RYAN~1.POT\AppData\Local\Temp\a43ef201-beb2-40e5-be0b-365213faf82e\Exploration of Resistance Variation on Motor Losses.ipynb" --to html --output tmp-8836d4tOWmV5wJ4f.html --output-dir C:\Users\RYAN~1.POT\AppData\Local\Temp --debug
10:18:14.156 [error] Export failed Error: Traceback (most recent call last):
  File "~\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "~\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "~\drive-designer\.venv\Scripts\jupyter-nbconvert.EXE\__main__.py", line 4, in <module>
  File "~\drive-designer\.venv\lib\site-packages\nbconvert\nbconvertapp.py", line 187, in <module>
    class NbConvertApp(JupyterApp):
  File "~\drive-designer\.venv\lib\site-packages\nbconvert\nbconvertapp.py", line 246, in NbConvertApp
    Options include {get_export_names()}.
  File "~\drive-designer\.venv\lib\site-packages\nbconvert\exporters\base.py", line 151, in get_export_names
    e = get_exporter(exporter_name)(config=config)
  File "~\drive-designer\.venv\lib\site-packages\nbconvert\exporters\base.py", line 110, in get_exporter
    exporter = items[0].load()
  File "~\AppData\Local\Programs\Python\Python310\lib\importlib\metadata\__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "~\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "~\drive-designer\.venv\lib\site-packages\jupyter_contrib_nbextensions\__init__.py", line 5, in <module>
    import jupyter_nbextensions_configurator
  File "~\drive-designer\.venv\lib\site-packages\jupyter_nbextensions_configurator\__init__.py", line 18, in <module>
    from notebook.base.handlers import APIHandler, IPythonHandler
ModuleNotFoundError: No module named 'notebook.base'

    at Uf.executeCommand (~\.vscode\extensions\ms-toolsai.jupyter-2024.3.1-win32-x64\dist\extension.node.js:360:9544)
    at _0.export (~\.vscode\extensions\ms-toolsai.jupyter-2024.3.1-win32-x64\dist\extension.node.js:361:505)
    at Jb.performNbConvertExport (~\.vscode\extensions\ms-toolsai.jupyter-2024.3.1-win32-x64\dist\extension.node.js:363:2488)
    at Jb.performExport (~\.vscode\extensions\ms-toolsai.jupyter-2024.3.1-win32-x64\dist\extension.node.js:363:2178)
    at Jb.exportImpl (~\.vscode\extensions\ms-toolsai.jupyter-2024.3.1-win32-x64\dist\extension.node.js:363:1798)
    at Jb.export (~\.vscode\extensions\ms-toolsai.jupyter-2024.3.1-win32-x64\dist\extension.node.js:363:1530)
    at e1.export (~\.vscode\extensions\ms-toolsai.jupyter-2024.3.1-win32-x64\dist\extension.node.js:412:3130)
    at d.h (~\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:152:186866)

Hi @rsp34

This issue occurs due to the presence of jupyter-contrib-nbextensions package. It shouldn't be specific to notebooks using Jupyter kernel for MATLAB and should affect notebooks using other kernels also.

To fix the issue, you could either

  1. Uninstall jupyter-contrib-nbextensions package if it is not needed. (or)
  2. Follow the workarounds mentioned in this stackoverflow post

Hope this helps.