First time here? Check out the FAQ!

Ask Your Question
1

jupyter notebook extensions in Sage 7.3?

asked 8 years ago

stan gravatar image

Has anyone installed the jupyter notebook extensions successfully in Sage 7.3? Here is what I tried on Debian jessy:

sage -sh
pip install https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master
pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user

This seemed to work, but I could not see any of the extensions in the configurator tab, so I enabled some of them manually:

jupyter nbextension enable toc2/main

Again, this seemed to work and I got a nice table of content. However, ipython nbconvert did not work any more, returning the followin error message:

    File "sage/local/lib/python2.7/site-packages/ipython_genutils/importstring.py",
line 31, in import_item
        module = __import__(package, fromlist=[obj])
TypeError: Item in ``from list'' not a string

After uninstalling all the above, I also had to rename the jupyter_nbconvert_config file before nbconvert would work again:

~/.jupyter$ mv jupyter_nbconvert_config.json old_jupyter_nbconvert_config.json

Does anyone have an idea what I should have done differently to use the jupyter notebook extensions in sage? Thanks for your help! Stan

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 8 years ago

stan gravatar image

Solution: Install the extensions as described in the OP, and then just rename or remove ~/.jupyter/jupyter_nbconvert_config.json:

~/.jupyter$ mv jupyter_nbconvert_config.json old_jupyter_nbconvert_config.json

This file is generated when running :

jupyter nbextensions_configurator enable --user

and has the following content:

{
  "Exporter": {
    "template_path": [
      ".", 
      "/home/sschyman/Programs/sage-upgrade/local/lib/python2.7/site-packages/jupyter_contrib_nbextensions/templates"
    ], 
    "preprocessors": [
      "jupyter_contrib_nbextensions.nbconvert_support.CodeFoldingPreprocessor", 
      "jupyter_contrib_nbextensions.nbconvert_support.PyMarkdownPreprocessor"
    ]
  }, 
  "NbConvertApp": {
    "postprocessor_class": "jupyter_contrib_nbextensions.nbconvert_support.EmbedPostProcessor"
  }, 
  "version": 1
}

Not sure why it causes the error described, but deleting it does not seem to cause any harm and nbconvert runs as it should.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 8 years ago

Seen: 1,621 times

Last updated: Sep 16 '16