You are not logged in.

#1 2025-05-27 13:17:48

raphix
Member
From: France
Registered: 2008-09-27
Posts: 56
Website

[fixed] nbconvert without local venv

I have installed "jupyter-nbconvert 7.16.6-1" through pacman, but it complains that it misses jupyter_contrib_nbextensions ("ModuleNotFoundError: No module named 'jupyter_contrib_nbextensions'").

I cannot find "jupyter_contrib_nbextensions" (I tried several options around Jupyter and nbextension) via Pacman or AUR. Is there a package?

I know how to install a local environment, I use that often for specific projects, but I would find it handy to have project independant way of converting notebook to pdf/html (jupyter-nbconvert --to pdf foo.ipynb).

Is it possible to use a system-wide installed jupyter-nbconvert without installing also a local virtualenv?

Last edited by raphix (2025-06-02 11:47:00)


configs files on github  -- keep up the good work, arch devs

Offline

#2 2025-05-27 17:32:43

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,287

Re: [fixed] nbconvert without local venv

I can't reproduce it and there no trace of "jupyter_contrib_nbextensions" in the nbconvert source at all. Please provide precise steps to reproduce.

Offline

#3 2025-05-27 20:11:22

raphix
Member
From: France
Registered: 2008-09-27
Posts: 56
Website

Re: [fixed] nbconvert without local venv

Thank you for your quick reply.

Here is my procedure:

$ pacman -Qo /usr/bin/jupyter-nbconvert
/usr/bin/jupyter-nbconvert appartient à jupyter-nbconvert 7.16.6-1
$ /usr/bin/jupyter-nbconvert --to pdf foo.ipynb
Traceback (most recent call last):
  File "/usr/bin/jupyter-nbconvert", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/lib/python3.13/site-packages/jupyter_core/application.py", line 284, in launch_instance
    super().launch_instance(argv=argv, **kwargs)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/traitlets/config/application.py", line 1075, in launch_instance
    app.start()
    ~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/nbconvert/nbconvertapp.py", line 420, in start
    self.convert_notebooks()
    ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/nbconvert/nbconvertapp.py", line 586, in convert_notebooks
    self.exporter = cls(config=self.config)
                    ~~~^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/nbconvert/exporters/templateexporter.py", line 354, in __init__
    super().__init__(config=config, **kw)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/nbconvert/exporters/exporter.py", line 123, in __init__
    self._init_preprocessors()
    ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/nbconvert/exporters/templateexporter.py", line 539, in _init_preprocessors
    super()._init_preprocessors()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/nbconvert/exporters/exporter.py", line 294, in _init_preprocessors
    self.register_preprocessor(preprocessor, enabled=True)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/nbconvert/exporters/exporter.py", line 253, in register_preprocessor
    preprocessor_cls = import_item(preprocessor)
  File "/usr/lib/python3.13/site-packages/traitlets/utils/importstring.py", line 33, in import_item
    module = __import__(package, fromlist=[obj])
ModuleNotFoundError: No module named 'jupyter_contrib_nbextensions'

What should I check/change?


configs files on github  -- keep up the good work, arch devs

Offline

#4 2025-05-28 06:20:51

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,287

Re: [fixed] nbconvert without local venv

The errors appears when loading the user-specified preprocessors:

        # Load user-specified preprocessors.  Enable by default.
        for preprocessor in self.preprocessors:
            self.register_preprocessor(preprocessor, enabled=True)

So this dependency comes from some custom preprocessor you have enabled in the configuration.

Offline

#5 2025-06-02 11:46:41

raphix
Member
From: France
Registered: 2008-09-27
Posts: 56
Website

Re: [fixed] nbconvert without local venv

Oh, thank you a lot for spotting that, there was a file "~/.jupyter/jupyter_nbconvert_config.json" with an offending line, refering to a pre-processor (jupyter_contrib_nbextensions.nbconvert_support.CodeFoldingPreprocessor).

I renamed the file, and it worked, as expected.

Topic can be closed, now.


configs files on github  -- keep up the good work, arch devs

Offline

Board footer

Powered by FluxBB