Skip to content
The Sage Cell Server---providing a way to embed Sage computations into any web page.
Python HTML JavaScript CSS Jupyter Notebook PHP Other
Branch: master
Clone or download

Latest commit


Type Name Latest commit message Commit time
Failed to load latest commit information.
contrib Install Octave statistics package May 6, 2020
doc Merge pull request #511 from fchapoton/patch-10 Apr 7, 2019
js Close Octave figure after saving it Apr 27, 2020
static Remove some obsolete jQuery wrapping May 24, 2020
submodules Use r.js for combining CSS files. Mar 2, 2016
templates Rephrase SageCellDoctor link Feb 18, 2020
tests no more xrange Dec 3, 2019
timing py3 print again Apr 8, 2019
.gitignore Update .gitignore for the changed layout. Apr 3, 2016
.gitmodules Use r.js for combining CSS files. Mar 2, 2016
LICENSE.txt Clarify the licensing situation, since we are importing Sage code in … May 7, 2013
Makefile Drop Canvas3D support as it was part of SageNB Dec 8, 2019 Drop sockjs-tornado patch, PyPI has a patched version now Oct 21, 2018 Drop Canvas3D support as it was part of SageNB Dec 8, 2019 Adjust import paths to ipykernel. Jan 23, 2016 Do not cap kernel restrictions in kernel_dealer Mar 25, 2018 Clarify callback argument type for database adapters Mar 17, 2019 Unicode clean up for permalink handling Mar 17, 2019 urlencode is now in urlib.parse Dec 15, 2019 Replace iteritems with items Dec 8, 2019 more python fixes Apr 14, 2019 Remove unused code and imports Dec 8, 2019 Fix argument handling in RootHandler Dec 15, 2019 Import Color from sage instead of sagenb Dec 15, 2019 no .next method in python3 Jan 1, 2020 Encode/decode session key Nov 4, 2019 Call numpy.random.seed() on forking a new kernel Apr 5, 2020 Encode/decode session key Nov 4, 2019 Clean up permalink handling and add logging Oct 22, 2018 Remove unused code and imports Dec 8, 2019 remove one unused variable Mar 13, 2019 Decode base64 encoded data to strings Mar 17, 2019 Use add_callback_from_signal to stop tornado Mar 17, 2019 Use tornado ioloop Nov 3, 2019

This is SageMathCell - a Sage computation web service.

Our mailing list is!forum/sage-cell

Security Warning

If you are going to run a world accessible SageMathCell server, you must understand security implications and should be able to implement reasonable precautions.

The worker account (which is your own one by default) will be able to execute arbitrary code, which may be malicious. Make sure that you are securing the account properly. Working with a professional IT person is a very good idea here. Since the untrusted accounts can be on any computer, one way to isolate these accounts is to host them in a virtual machine that can be reset if the machine is compromised.

Simple Installation

We assume that you have access to the Internet and can install any needed dependencies. If you need to know more precisely what tools are needed, please consult the scripts for building virtual machine images in contrib/vm. In particular, system packages installed in the base container are listed here.

  1. Install requirejs:

    sudo apt-get install npm
    # On Debian based systems we need to make an alias
    sudo ln -s /usr/bin/nodejs /usr/bin/node
    sudo npm install -g requirejs
  2. Get and build Sage (export MAKE="make -j8" or something similar can speed things up):

    git clone
    pushd sage
  3. Prepare Sage for SageMathCell:

    sage/sage -pip install lockfile
    sage/sage -pip install paramiko
    sage/sage -pip install sockjs-tornado
    sage/sage -pip install sqlalchemy
  4. Build SageMathCell:

    git clone
    pushd sagecell
    git submodule update --init --recursive
    ../sage/sage -sh -c make

Major JavaScript dependencies, including Require.js and CodeMirror.js, are copied from the Jupyter notebook bundled with SageMath.


  1. Go into the sagecell directory (you are there in the end of the above instructions).

  2. Copy to (Or fill only with entries that you wish to change from default values.)

  3. Edit according to your needs. Of particular interest are host and username entries of the provider_info dictionary: you should be able to SSH to username@host without typing in a password. For example, by default, it assumes you can do ssh localhost without typing in a password. Unless you are running a private and firewalled server for youself, you’ll want to change this to a more restrictive account; otherwise anyone will be able to execute any code under your username. You can set up a passwordless account using SSH: type “ssh passwordless login” into Google to find lots of guides for doing this, like You may also wish to adjust db_config["uri"] (make the database files readable only by the trusted account).

  4. You may want to adjust to suit your needs and/or adjust system configuration. By default logging is done via syslog which handles multiple processes better than plain files.

  5. Start the server via

    ../sage/sage [-p <PORT_NUMBER>]

    where the default <PORT_NUMBER> is 8888 and go to http://localhost:<PORT_NUMBER> to use the Sage Cell server.

    When you want to shut down the server, press Ctrl-C in the same terminal.


See the LICENSE.txt file for terms and conditions for usage and a DISCLAIMER OF ALL WARRANTIES.

Browser Compatibility

SageMathCell is designed to be compatible with recent versions of:

  • Chrome
  • Firefox
  • Internet Explorer
  • Opera
  • Safari

If you notice issues with any of these browsers, please let us know.

You can’t perform that action at this time.