The Sage Cell Server---providing a way to embed Sage computations into any web page.
Python JavaScript HTML CSS CoffeeScript Jupyter Notebook Other
Failed to load latest commit information.
contrib Really clean up temporary files Feb 26, 2017
doc Update instructions to use HTTPS and /static/ Jul 26, 2016
js Don't show Three.js renderer type Sep 18, 2016
router-ipc Set up a router-ipc directory to house the AsyncSender ipc pipes. Nov 23, 2013
static Delete no longer used sagelogo Jul 9, 2016
submodules Use r.js for combining CSS files. Mar 2, 2016
templates Root template cleanup Sep 25, 2016
tests Make the interact test page served from the static directory, and mak… Jun 30, 2013
timing Fix simple testing scripts for the new session id handling. Apr 26, 2012
.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 Bundle CSS to make sure it is loaded before using CodeMirror Jul 8, 2016 Adjust configuration files. Jan 22, 2017 Adjust threejs iframe template for iOS Jan 29, 2017 Adjust import paths to ipykernel. Jan 23, 2016 Adjust configuration files. Jan 22, 2017 Allow the user to create permalinks with interact values and bookmarks Aug 4, 2013 Don't try to be smarter with encoding back. Sep 14, 2016 Allow the user to create permalinks with interact values and bookmarks Aug 4, 2013 Implement readonly and locations parameters to interacts Aug 3, 2013 Add linear algebra exercise example. Sep 12, 2013 Specify encoding when writing user code to a file. May 30, 2016 Add cone, cylinder, and box functions Dec 13, 2013 Import ioloop from tornado unless need to install Oct 24, 2016 Update deprecated import of srange Aug 30, 2016 Revert d0833cd Sep 14, 2016 Catch all messages, not just ours and tornado. Nov 24, 2014 Use pub_thread instead of pub_socket Apr 3, 2016 Fix typo in namespace deletion Aug 8, 2013 Avoid double Unicode decoding. Sep 14, 2016 Switch permalink server to systemd Sep 11, 2016 Revert "Suppress default-related DeprecationWarning from IPython.core… Jun 13, 2016 Set up a router-ipc directory to house the AsyncSender ipc pipes. Nov 23, 2013 Import our log configurator before ipython/tornado. May 15, 2016 Import our log configurator before ipython/tornado. May 15, 2016 React sensibly to signal and use sd_notify if available Aug 14, 2016

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 contib/vm. In particular, system packages installed in the base container are listed here.

  1. Make sure you have a recent enough version of git: 1.8.5 is good enough, while 1.7.9 isn't.
  2. Install required npm packages:

    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 inherits requirejs coffee-script
  3. Optionally create a directory for all components:

    mkdir sc_build
    cd sc_build
  4. Get and build Sage (export MAKE="make -j8" or something similar can speed things up):

    git clone
    pushd sage
    git checkout sagecell
    ./sage -i threejs

    Note that we are building a special branch of Sage, do NOT use your regular Sage installation!

  5. Prepare Sage for SageMathCell:

    sage/sage -pip install --upgrade lockfile
    sage/sage -pip install --upgrade paramiko
    sage/sage -pip install --upgrade sockjs-tornado
  6. 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 _default_config 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.