# Installing Autopep8 extension

**URL:** <https://swan-community.web.cern.ch/t/installing-autopep8-extension/615>\
**Category:** Jupyter Notebooks\
**Created:** [January 19, 2023, 9:09am UTC](https://swan-community.web.cern.ch/t/installing-autopep8-extension/615 "2023-01-19T09:09:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![londris](https://swan-community.web.cern.ch/letter_avatar_proxy/v4/letter/l/dec6dc/32.png) [@londris](https://swan-community.web.cern.ch/u/londris)\
**Post date:** [January 19, 2023, 9:09am UTC](https://swan-community.web.cern.ch/t/installing-autopep8-extension/615/1 "2023-01-19T09:09:35Z")

</div>

Hello,

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](https://swan.docs.cern.ch/advanced/enable_extensions/)

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:

```auto
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:

```auto
Traceback (most recent call last):
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_102b_swan/x86_64-centos7-gcc11-opt/bin/jupyter-nbextension", line 33, in <module>
    sys.exit(load_entry_point('notebook==6.4.0', 'console_scripts', 'jupyter-nbextension')())
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_102b_swan/x86_64-centos7-gcc11-opt/lib/python3.9/site-packages/jupyter_core/application.py", line 254, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_102b_swan/x86_64-centos7-gcc11-opt/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
    app.start()
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_102b_swan/x86_64-centos7-gcc11-opt/lib/python3.9/site-packages/notebook/nbextensions.py", line 980, in start
    super().start()
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_102b_swan/x86_64-centos7-gcc11-opt/lib/python3.9/site-packages/jupyter_core/application.py", line 243, in start
    self.subapp.start()
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_102b_swan/x86_64-centos7-gcc11-opt/lib/python3.9/site-packages/notebook/nbextensions.py", line 708, in start
    self.install_extensions()
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_102b_swan/x86_64-centos7-gcc11-opt/lib/python3.9/site-packages/notebook/nbextensions.py", line 679, in install_extensions
    full_dests = install(self.extra_args[0],
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_102b_swan/x86_64-centos7-gcc11-opt/lib/python3.9/site-packages/notebook/nbextensions.py", line 203, in install_nbextension_python
    m, nbexts = _get_nbextension_metadata(module)
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_102b_swan/x86_64-centos7-gcc11-opt/lib/python3.9/site-packages/notebook/nbextensions.py", line 1114, in _get_nbextension_metadata
    m = import_item(module)
  File "/cvmfs/sft.cern.ch/lcg/views/LCG_102b_swan/x86_64-centos7-gcc11-opt/lib/python3.9/site-packages/traitlets/utils/importstring.py", line 38, in import_item
    return __import__ (parts[0])
ModuleNotFoundError: No module named 'Autopep8'

```

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

Ladislav

---

<div class="post-metadata">

**Author:** ![krraghav](https://swan-community.web.cern.ch/user_avatar/swan-community.web.cern.ch/krraghav/32/177_2.png) [@krraghav](https://swan-community.web.cern.ch/u/krraghav)\
**Post date:** [January 19, 2023, 2:39pm UTC](https://swan-community.web.cern.ch/t/installing-autopep8-extension/615/2 "2023-01-19T14:39:59Z")

</div>

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?

Regards  
Krishnan
