Installing Autopep8 extension


I would like to enable certain nbextensions in my Jupyter Notebooks, for example the Autopep8 extension.

I tried to follow the documentation on this page: Install and enable notebook extensions - Help

I executed the following command jupyter nbextension enable Autopep8, but it says the module could not be found.

So I assumed the extension is not available, so I followed the section on how to enable extension that is not provided by SWAN:

pip install --user Autopep8
export JUPYTER_DATA_DIR=$CERNBOX_HOME/.local/share/jupyter
jupyter nbextension install --py --symlink --user Autopep8
jupyter nbextension enable Autopep8 --user --py

Unfortunately, an exception is thrown upon the execution of the third command:

Traceback (most recent call last):
  File "/cvmfs/", line 33, in <module>
    sys.exit(load_entry_point('notebook==6.4.0', 'console_scripts', 'jupyter-nbextension')())
  File "/cvmfs/", line 254, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/cvmfs/", line 845, in launch_instance
  File "/cvmfs/", line 980, in start
  File "/cvmfs/", line 243, in start
  File "/cvmfs/", line 708, in start
  File "/cvmfs/", line 679, in install_extensions
    full_dests = install(self.extra_args[0],
  File "/cvmfs/", line 203, in install_nbextension_python
    m, nbexts = _get_nbextension_metadata(module)
  File "/cvmfs/", line 1114, in _get_nbextension_metadata
    m = import_item(module)
  File "/cvmfs/", line 38, in import_item
    return __import__(parts[0])
ModuleNotFoundError: No module named 'Autopep8'

What might be the problem here? Thanks for your help.


Dear Ladislav,

Autopep8 is pre-installed but not enabled. You can enable it from the UI.

  • Click on the menu from the page after starting your session (three dots on top right) and click “Nbextensions configuration”
  • Untick “disable configuration for nbextensions without explicit compatibility”
  • Tick and enable autopep8 extension
  • Reload any notebook pages

Does this work for you?