Ask Your Question

Revision history [back]

If Sage is installed on your computer, then in a terminal, run

$ sage -ipython

this will lauch the Python that comes with Sage, and it will know where sage is. Then you can

%load_ext sage

[EDITED: initial answer was about plain IPython but failed to address the specific question about IPython notebook]

If Sage is installed on your computer, then in a terminal, runyou can run IPython by typing:

$ sage -ipython

this This will lauch the Python that comes with Sage, and it will know where sage Sage is. Then you can

%load_ext sage

To get the IPython notebook, type the following in a terminal:

$ sage -ipython notebook

You might get an import error complaining about the version of pyzmq:

ImportError: IPython.html requires pyzmq >= 2.1.11

To address that, you will need to install pyzmq, see this webpage by Jose Guzman for instructions.

[EDITED: initial answer was about plain IPython but failed to address the specific question about IPython notebook]

If Sage is installed on your computer, then in a terminal, you can run IPython by typing:

$ sage -ipython

This will lauch the Python that comes with Sage, and it will know where Sage is. Then you can

%load_ext sage

To get the IPython notebook, type the following in a terminal:

$ sage -ipython notebook

You might get an import error complaining about the version of pyzmq:

ImportError: IPython.html requires pyzmq >= 2.1.11

To address that, you will need to install pyzmq, see which I did by just typing:

$ sage -i zeromq
$ sage -i pyzmq

and then I was able to successfully launch the IPython notebook by typing:

$ sage -ipython notebook

Thank you for your question, I'm happy that I got this webpage by Jose Guzman for instructions.

working!

[EDITED: my initial answer was about plain addressed IPython but failed to address the specific question about IPython notebook]not the IPython notebook.]

If Sage is installed on your computer, then in a terminal, you can run IPython the IPython that came with Sage by typing:

$ sage -ipython

This will lauch the Python that comes with Sage, and it IPython will know where Sage is. Then you can

%load_ext sage

To get the IPython notebook, type the following in a terminal:

$ sage -ipython notebook

You might get an import error complaining about the version of pyzmq:

ImportError: IPython.html requires pyzmq >= 2.1.11

To address that, you will need to install pyzmq, which I did by just typing:

$ sage -i zeromq
$ sage -i pyzmq

and you can then I was able to successfully launch the IPython notebook by typing:

$ sage -ipython notebook

Once you have launched the IPython notebook in this way, you can

%load_ext sage

Thank you for your question, I'm happy that I got this working!

[EDITED: my initial answer addressed IPython but not the IPython notebook.]

If Sage is installed on your computer, then

Sage in IPython and IPython notebook

You can use Sage inside IPython and IPython notebook by loading the Sage extension, which will also load the Sage preparser and let you use Sage commands in IPython or IPython notebook just as you would in Sage itself.

For this, just type

%load_ext sage

in the IPython provided with Sage, so it knows where Sage is. To run that particular IPython in a terminal, you can run the IPython that came with Sage by typing:type

$ sage -ipython

This IPython will know where Sage is. Then you can

%load_ext sage

To get the IPython notebook, type the following in a terminal:or, if you want the IPython notebook,

$ sage -ipython notebook

You might Note that for Sage versions older than 6.2.beta8, instead of %load_ext sage you should type

 %load_ext sage.misc.sage_extension

Dependencies of the Sage extension

The dependencies are the Tornado web framework, as well as ZeroMQ and its Python bindings PyZMQ.

If ZeroMQ and PyZMQ are not installed, you will get an import error complaining about the version of pyzmq:like

ImportError: IPython.html requires pyzmq >= 2.1.11

To address that, If ZeroMQ and PyZMQ are installed, but Tornado is not installed, you will get an attribute error like

start_ipython()
File "/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/numpy/lib/polynomial.py", line 11, in <module> import numpy.core.numeric as NX.
AttributeError: 'module' object has no attribute 'core'.

Recent versions of Sage ship Tornado, and upcoming versions will ship ZeroMQ and PyZMQ.

Installing Tornado

Tornado is included in Sage from 6.2.beta5 on. It if you have an older Sage, the simplest is to upgrade to the current version! At this day (2014-07-12), Sage 6.2 and Sage 6.3.beta5 are available.

For an older Sage, install pyzmq, which I did by Tornado as explained on the Tornado installation page. Under Linux, you could:

$ sudo apt-get install uuid-dev
$ sage -sh
$ easy_install-2.7 tornado

Installing zeromq and pyzmq

These will be shipped with Sage 6.3 when it is released.

Until then, just typing:type this in a terminal (requires web access, and assumes sage points to your Sage):

$ sage -i zeromq
$ sage -i pyzmq

and you can then launch the IPython notebook by typing:

$ sage -ipython notebook

Once you have launched the IPython notebook in this way, you can

%load_ext sage

Thank you for your question, I'm happy that I got this working!

Sage in IPython and IPython notebook

You can use Sage inside IPython and IPython notebook by loading the Sage extension, which will also load the Sage preparser and let you use Sage commands in IPython or IPython notebook just as you would in Sage itself.

For this, just in the IPython provided with Sage (so it knows where Sage is), type

%load_ext sage

in To run the IPython provided with Sage, so it knows where Sage is. To run that particular IPython type in a terminal, typeterminal

$ sage -ipython

or, if you want the IPython notebook,

$ sage -ipython notebook

Note that for Sage versions older than 6.2.beta8, instead of %load_ext sage you should type

 %load_ext sage.misc.sage_extension

Dependencies of the Sage extension

The dependencies are the Tornado web framework, as well as ZeroMQ and its Python bindings Python bindingsPyZMQ PyZMQ..

If ZeroMQ and PyZMQ are not installed, you will get an import error like

ImportError: IPython.html requires pyzmq >= 2.1.11

If ZeroMQ and PyZMQ are installed, but Tornado is not installed, you will get an attribute error like

start_ipython()
File "/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/numpy/lib/polynomial.py", line 11, in <module> import numpy.core.numeric as NX.
AttributeError: 'module' object has no attribute 'core'.

Recent versions of Sage ship Tornado, and upcoming versions will ship ZeroMQ and PyZMQ.

Installing Tornado

Tornado is included in Sage from 6.2.beta5 on. It if you have an older Sage, the simplest is to upgrade to the current version! At this day (2014-07-12), Sage 6.2 and Sage 6.3.beta5 are available.

For Why not get the latest release (Sage 6.2) or development release (Sage 6.3.beta5).

Or, for an older Sage, install Tornado as explained on the Tornado installation page. Under Linux, you could:can:

$ sudo apt-get install uuid-dev
$ sage -sh
$ easy_install-2.7 tornado

Installing zeromq and pyzmq

These will be shipped with Sage 6.3 when it is released.

Until then, just type this in a terminal (requires web access, and assumes sage points to your Sage):

$ sage -i zeromq
$ sage -i pyzmq

Sage in IPython and IPython notebook

You can use Sage inside IPython and IPython notebook by loading the Sage extension, which will also load the Sage preparser and let you use Sage commands in IPython or IPython notebook just as you would in Sage itself.

For this, in use the IPython provided with Sage (so it knows where Sage is), and type

%load_ext sage

To run the IPython provided with Sage, type in a terminal

$ sage -ipython

or, if you want the IPython notebook,

$ sage -ipython notebook

Note that for Sage versions older than 6.2.beta8, instead of %load_ext sage you should type

 %load_ext sage.misc.sage_extension

Dependencies of the Sage extension

The dependencies are the Tornado web framework, as well as ZeroMQ and its Python bindings PyZMQ.

If ZeroMQ and PyZMQ are not installed, you will get an import error like

ImportError: IPython.html requires pyzmq >= 2.1.11

If ZeroMQ and PyZMQ are installed, but Tornado is not installed, you will get an attribute error like

start_ipython()
File "/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/numpy/lib/polynomial.py", line 11, in <module> import numpy.core.numeric as NX.
AttributeError: 'module' object has no attribute 'core'.

Recent versions of Sage ship Tornado, and upcoming versions will ship ZeroMQ and PyZMQ.

Installing Tornado

Tornado is included in Sage from 6.2.beta5 on. Why not get the latest release (Sage 6.2) or development release (Sage 6.3.beta5).

Or, for an older Sage, install Tornado as explained on the Tornado installation page. Under Linux, you can:

$ sudo apt-get install uuid-dev
$ sage -sh
$ easy_install-2.7 tornado

Installing zeromq and pyzmq

These will be shipped with Sage 6.3 when it is released.

Until then, just type this in a terminal (requires web access, and assumes sage points to your Sage):

$ sage -i zeromq
$ sage -i pyzmq

Sage in IPython and IPython notebook

You can use Sage inside IPython and IPython notebook by loading the Sage extension, which will also load the Sage preparser and let you use Sage commands in IPython or IPython notebook just as you would in Sage itself.

For this, use the IPython provided with Sage (so it knows where Sage is), and type

%load_ext sage

To run the IPython provided with Sage, type in a terminal

$ sage -ipython

or, if you want the IPython notebook,

$ sage -ipython notebook

[2014-10-23: Edit: in Sage 6.4.beta6 or later,

$ sage --notebook=ipython

should also work.]

Note that for Sage versions older than with any Sage version before 6.2.beta8, instead of %load_ext sage you should type

 %load_ext sage.misc.sage_extension

Dependencies of the Sage extensionSage extension to the IPython notebook: dependencies

The dependencies are the Tornado web framework, as well as ZeroMQ and its Python bindings PyZMQ.

[2014-10-23: Edit: Starting with Sage 6.4.beta6, these are standard packages so you have nothing to do.]

If ZeroMQ and PyZMQ are not installed, you will get an import error like

ImportError: IPython.html requires pyzmq >= 2.1.11

If ZeroMQ and PyZMQ are installed, but Tornado is not installed, you will get an attribute error like

start_ipython()
File "/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/numpy/lib/polynomial.py", line 11, in <module> import numpy.core.numeric as NX.
AttributeError: 'module' object has no attribute 'core'.

Recent versions of Sage ship Tornado, and upcoming versions will ship ZeroMQ and PyZMQ.

Installing Tornado

Tornado is included in Sage from 6.2.beta5 on. Why not get the latest release (Sage 6.2) or development release (Sage 6.3.beta5).

Or, for an older Sage, install Tornado as explained on the Tornado installation page. Under Linux, you can:

$ sudo apt-get install uuid-dev
$ sage -sh
$ easy_install-2.7 tornado

Installing zeromq and pyzmq

These will be shipped [2014-10-23: Edit: Starting with Sage 6.3 when it is released.

Until then, just type this 6.4.beta6, these are standard packages so you have nothing to do.]

Using older versions of Sage: in a terminal (requires (with web access, and assumes assuming sage points to your Sage):

$ sage -i zeromq
$ sage -i pyzmq