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.

smc-terminal

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.

smc-stats-notebook

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.

smc-rmagic-notebook

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.

LaTeX

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.

smc-upload-from-web

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.

smc-latex-editing-viewing

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.

smc-latex-live-editing

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.

smc-notebook-live-coding

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.

smc-automatic-backup

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.

Randy is a PhD candidate in Michigan State University's Computer Science program. As a member of Dr. Chris Adami's research lab, he studies biologically-inspired artificial intelligence and evolutionary processes.

Posted in ipython, productivity, python Tagged with: , , , , , ,
  • http://gravatar.com/aronahmadia Aron Ahmadia

    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 https://github.com/hashdist/hashstack2 (not affiliated with SMC either) is building up complete Python stacks from the ground up on SageMathCloud, and everything just works.

    • http://www.randalolson.com Randy Olson

      Awesome, thanks for sharing Aron!

      • https://plus.google.com/+OndřejČertík Ondřej Čertík

        In fact, if you follow the README in hashstack2 (e.g. notice the file cloud.sagemath.yaml), it will just work on SMC.

  • http://gravatar.com/wstein389 wstein389

    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.)

    • http://www.randalolson.com Randy Olson

      Thanks for the great service. :-)

  • http://fperez.org Fernando Perez

    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!

    • http://gravatar.com/wstein389 wstein389

      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.

      • http://fperez.org fperez

        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.

  • Paul Dehaye

    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?

    • http://www.randalolson.com Randy Olson

      I’ll take a twist on Sigismund’s famous quote. “I am a computer programmer, and above grammar.” :-P

  • Pingback: Working with Ipython notebooks in the cloud http… | Sharing useful stuff with peers()

About this blog

The data visualizations on this blog are the result of my “data tinkering” hobby, where I tackle a new data analysis problem every week. If I find something interesting, I report my findings here to share with the world.

If you like the work in this blog, I'm currently available for hire as a freelancer. Send me an email if you'd like to discuss freelance work.

If you would like to use one of my graphs on your website or in a publication, please email me.

Archives

Enter your email address to subscribe to this blog and receive notifications of new posts by email.