Sagemath Cloud makes collaborating with IPython Notebooks easier than ever

Earlier this year, Sagemath Cloud went into open beta so anyone can play around with it. If you’re not familiar with the service, it’s a free cloud-based web service that provides access to personal directories, a terminal, IPython Notebook (incl. Rmagic), a LaTeX editor, compiler, & viewer, and so much more — all from the web, so no installation required!

I see this tool being revolutionary not just for research collaboration, but for teaching as well. Imagine live coding with a class and having the code appear right on their screen as you type it. Even better, imagine not having to go through the installation process on several different operating systems every time you teach a new class.

I ran across Sagemath Cloud last month and have been using it to collaborate with my mentees ever since. Since I have a bit of experience with it, I’ll provide an overview of what you can do with Sagemath Cloud below.

Disclaimer: I don’t work for nor with the Sagemath Cloud folks, I’m just really excited about this service!

All the basics

Of course, Sagemath Cloud has all the basics. It has a directory structure for you to upload and organize your files and a terminal to run programs and scripts as you please.


With the click of a button, you can start up an IPython Notebook and start coding away. They seem to have all of the standard scientific computing libraries installed already. I was able to replicate my Python stats tutorial without a hitch.


They even have the IPython magic libraries installed, so I was able to replicate my Rmagic IPython tutorial and run R code in the IPython Notebook as well.


They don’t have all Python libraries installed yet, and it doesn’t look like you can install your own libraries just yet. I’m sure they will install libraries by request however. It’d be especially nice if everyone could have their own Python installation and install any library as they like.

Edit: Apparently it is possible to install your own Python libraries. See Aron’s comment.


Sagemath Cloud lets you upload files directly from the web, so if you’re writing a PLoS article, you can upload the template to Sagemath Cloud and immediately start editing it from there. You can do this with IPython Notebooks as well, so if you find a notebook on the web that you want to hack away on, just upload the file from the URL here.


Even better, Sagemath Cloud has a built-in LaTeX editor, compiler, and viewer. My lab has been paying for this service at ShareLaTeX, but now it’s completely free here.


Live editing and collaboration

One benefit of working on the web is that multiple people can work on a document at once. Sagemath Cloud makes this happen for all of the services it offers, including LaTeX.


Everything has been fairly run-of-the-mill for people who are familiar with these kinds of web services so far, but the following is what really sets Sagemath Cloud above the rest for me. You can write and execute code live with others on the same IPython Notebook.


My mind was blown when I saw this feature. This is a feature I’ve wanted for IPython Notebook ever since I started using it. The future is here, folks!

Automatic backup

Another benefit of working on the web is that you don’t have to worry about backing up files. Sagemath Cloud takes care of all that for you and makes frequent snapshots of your working directories so you can return to previous versions of your work without a problem.


Remember: Sagemath Cloud is in beta testing

I’ll end this with the note that Sagemath Cloud is still in beta testing. That means it won’t always run perfectly, probably has some bugs, and may even crash sometimes. It’s not intended for production use yet, but it will eventually have buy-in options to have priority access to the service. Make sure to report any problems you run into to William Stein.

Dr. Randy Olson is an AI Scientist at Absci using data science and deep learning to make medicines better and make better medicines.

Tagged with: , , , , , ,
10 comments on “Sagemath Cloud makes collaborating with IPython Notebooks easier than ever
  1. Aron Ahmadia says:

    Hey Randy, thanks for the post. Just a quick correction:

    They don’t have all Python libraries installed yet, and it doesn’t look like you can install your own libraries just yet. I’m sure they will install libraries by request however. It’d be especially nice if everyone could have their own Python installation and install any library as they like.

    Sure you can! Just open a terminal and get going 🙂 The team at (not affiliated with SMC either) is building up complete Python stacks from the ground up on SageMathCloud, and everything just works.

  2. wstein389 says:

    Thanks for your great post! (NOTE: Sometimes IPython notebooks will disconnect (requiring a reload) after a while — I’m working hard on fixing this problem right now.)

  3. William, let us know if there’s anything on our side that’s causing the problem or making it worse. And thanks for SMC, it’s really awesome!

    • wstein389 says:

      I’ve deployed a workaround for the IPython issue I mentioned above (thanks to Ondrej Certik for some help with this). Fernando — I don’t know the root issue, but calling IPython.notebook.kernel.start_channels() periodically to reconnect the websocket seems to robustly work around the problem, so I’m going with this for now. I also tried IPython almost 2, but that was no different (I love the new directory support!). This is likely some subtle interaction between IPython websockets and the multiple levels of proxying in SMC.

      • fperez says:

        William, I suspect the layers of proxying are causing this, but there may also some brittleness on our side we might be able to improve upon. We’ve made changes on the websockets handling already to make them more robust, but I’ve still occasionally managed to ‘wedge’ the server, so I know we still have work to do on that front.

        The multidir support is great, and we’ll soon be working on the UI side of it, so it becomes possible to navigate the filesystem directly from the dashboard. Then it will be a lot easier to manage multiple notebooks from a single server.

        We’ll also add support for registering other kernels in the file itself, so that a single server can be used to start ipython, ijulia, ihaskell, etc. kernels. And obviously that would allow a ‘sage’ kernel as well (which wouldn’t have the sage notebook UI integration, but all the language features.

  4. Paul Dehaye says:

    The lines “I wrote and ran this code on this computer” and “I wrote and ran this code on another computer” are confusing. Would be better to replace “on” by “from”, no?