简体   繁体   中英

Error enabling python-markdown extension for jupyter notebooks

I downloaded and installed the python-markdown extension that lives inside the nbextensions repo here:

jupyter_contrib_nbextensions/src/jupyter_contrib_nbextensions/nbextensions/python-markdown/python-markdown.yaml

jupyter-nbextension install python-markdown

At the end of the installation the following is posted:

Copying: /git/jupyter_contrib_nbextensions/src/jupyter_contrib_nbextensions/nbextensions/python-markdown/python-markdown-post.png -> /usr/local/share/jupyter/nbextensions/python-markdown/python-markdown-post.png

To initialize this nbextension in the browser every time the notebook (or other app) loads:

      jupyter nbextension enable <the entry point>

So I tried:

$jupyter nbextension enable python-markdown

Which gave:

Enabling notebook extension python-markdown...
      - Validating: problems found:
        - require?  X python-markdown

I am uncertain how to proceed here.

The short answer
jupyter nbextension enable python-markdown/main

The long answer

The documentation seems to be not so clear but it states...

  jupyter nbextension enable <nbextension require path>

So it is imperative that we give the path to the js file related to the extension. To figure out what the actual file is, we should look for jupyter data paths

>>>foo$ jupyter --paths
config:
    /Users/foo/.jupyter
    /Users/foo/miniconda3/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /Users/foo/Library/Jupyter
    /Users/foo/miniconda3/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /Users/foo/Library/Jupyter/runtime

I looked in the /Users/foo/Library/Jupyter folder

>>>foo$ find  /Users/foo/Library/Jupyter -name python-markdown
/Users/foo/Library/Jupyter/nbextensions/python-markdown
>>>foo$ find /Users/foo/Library/Jupyter/nbextensions/python-markdown -name *js
/Users/foo/Library/Jupyter/nbextensions/python-markdown/main.js

Now I decided to use the path as python-markdown/main :-

>>>foo$ jupyter nbextension enable python-markdown/main
Enabling notebook extension python-markdown/main...
      - Validating: OK
>>>foo$ jupyter nbextension list
Known nbextensions:
  config dir: /Users/foo/.jupyter/nbconfig
    notebook section
      python-markdown  enabled 
      - Validating: problems found:
        - require?  X python-markdown
      python-markdown/main  enabled 
      - Validating: OK

Edited the output above reflect more appropriate lines.

Note that my old python-markdown is still having problem validating but the new python-markdown/main is now enabled and validated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM