How to install IPython notebook extensions

711 views
Skip to first unread message

Andrew Malcolmson

unread,
Dec 1, 2015, 8:47:55 AM12/1/15
to sage-cloud
I'm experimenting with creating basic math worksheets for children and I need the ablility to hide some code cells.  I believe this extension allows that:


I've tried cloning the repo and running 'python setup.py install' but the installer cannot find the Jupyter modules so apparently the notebook is running from another Python install which I can't find.  I also tried copying the contents of the nbextensions directory into ~/.ipython/nbextensions but the notebook can't find them.

How may I install this extension or are there better ways to get cell hiding?  Thanks

Harald Schilly

unread,
Dec 1, 2015, 10:50:05 AM12/1/15
to sage-...@googlegroups.com
Hi, I'm not sure if this works, but since ipython is installed inside
Sage, the configuration directory is different. I.e. the command
"ipython locate" gives "~/.sage/ipython-4.0.0/" for me, and inside
that directory is "nbextensions".

-- harald
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/832d5afd-78ee-4473-9f7b-7d7576fbcba8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Andrew Malcolmson

unread,
Dec 1, 2015, 12:06:13 PM12/1/15
to sage-...@googlegroups.com
Thanks but it doesn't Jupyter/IPython doesn't find them there either.

I understand that Jupyter version 4 uses a new configuration system:


However I can't follow this document because it seems the system Python install in the shell is not the one used by Jupyter/IPython since if I run this:

jupyter nbextension enable <any extension name>

I get this:

Traceback (most recent call last):
  File "/usr/local/bin/jupyter", line 7, in <module>
    from jupyter_core.command import main
ImportError: No module named jupyter_core.command

So, where in the system is that Python installed?

Thanks again.


You received this message because you are subscribed to a topic in the Google Groups "sage-cloud" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-cloud/qPeYxJ80cFI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-cloud+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/CAGG4CB4WLFb_05tueg7SBfsmbgM%3DiOANc8hyKxjoThEdc_vgyA%40mail.gmail.com.

William Stein

unread,
Dec 1, 2015, 12:09:45 PM12/1/15
to sage-cloud
On Tue, Dec 1, 2015 at 9:05 AM, Andrew Malcolmson <and...@gmail.com> wrote:
> Thanks but it doesn't Jupyter/IPython doesn't find them there either.
>
> I understand that Jupyter version 4 uses a new configuration system:
>
> https://github.com/ipython-contrib/IPython-notebook-extensions/wiki/Home_Jupyter
>
> However I can't follow this document because it seems the system Python
> install in the shell is not the one used by Jupyter/IPython since if I run
> this:
>
> jupyter nbextension enable <any extension name>
>
> I get this:
>
> Traceback (most recent call last):
> File "/usr/local/bin/jupyter", line 7, in <module>
> from jupyter_core.command import main
> ImportError: No module named jupyter_core.command
>
> So, where in the system is that Python installed?

Type "sage -sh" to set the environment to use the python that runs the
Jupyter notebook.

I've not heard of anybody ever installing a jupyter extension for Sage
yet, or in SageMathCloud, and I've never done it. So we're not just
being cryptic about how to do this -- we don't know / haven't tried
yet.

William
> https://groups.google.com/d/msgid/sage-cloud/CALX2Y5W88L7UT9VyDSSP1AG1d-44oeXOvJSd6DHJhyuqiGNKuw%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--

Best Regards,
William

Found/CEO of SageMath, Inc.

Professor of Mathematics

Andrew Malcolmson

unread,
Dec 1, 2015, 12:54:20 PM12/1/15
to sage-...@googlegroups.com
OK, thanks William, getting somewhere now

Python version:
/projects/sage/sage-6.9/local/bin/python

Local Jupyter config dir:
~/.jupyter

Local nbextensions dir:
.local/share/jupyter/

Prepended /projects/sage/sage-6.9/local/bin to $PATH and tried again:

'setup.py install' from the nbextensions repo I downloaded before now works and installs extensions in .local/share/jupyter.  

'jupyter nbextension enable' still fails with a missing notebook module.

The Python code to enable exentsions (from document I linked to above) succeeds and the local notebook config files now list extensions enabled. 

However, even after a restart, I don't see any sign of the exensions in the Notebook itself.   That's all the time I have for today.

Reply all
Reply to author
Forward
0 new messages