Setting up the Eclipse Theia IDE on an Amazon SageMaker Notebook Instance

Sofian Hamiti
Jan 3 · 4 min read

Jupyter Notebooks provide useful environments to interactively explore and experiment during an ML project. However, by helping many teams deliver ML solutions for large enterprises on AWS, I often noticed a time in the project when data scientists and ML engineers needed to work with a full-fledged cloud-based IDE offering better code-completion and debugging capabilities for containers running in SageMaker.

In this post, I will show how you can install and run the Theia IDE on a SageMaker Notebook Instance using a Lifecycle Configuration.

Image for post
Image for post
SageMaker + Theia = ❤

Amazon SageMaker is a fully managed service bringing together a broad set of capabilities to help you prepare, build, train, and deploy high-quality ML models quickly.

Image for post
Image for post
Overview of SageMaker capabilities as of January 2021

Using SageMaker Studio or Notebook Instances are good options for you to access an ML environment running Jupyter with compute and pre-installed popular ML libraries. SageMaker manages the creation of the underlying instances and resources so you can get started quickly in your ML project.

The Eclipse Theia IDE

Image for post
Image for post
source: Theia github repository

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript. It reuses components like the Monaco code editor from the VS Code open source project and can run on a web-browser. See here for a comparison of Theia with VS Code.

It is compatible with VS Code in terms of extensions which means you can install many of the existing extensions without modification! You can also add new features to the IDE via plugins. See here for differences between extensions and plugins

What’s even better is that you can run Theia alongside notebooks in your Jupyter environment by using this plugin for jupyter-server-proxy on your notebook instance.

In the following section I will show you how to automate this setup with a Lifecycle Configuration.

Running Theia on a Notebook Instance

Here we will create a lifecycle configuration running at the start of your notebook instance. If needed, you can watch this video to learn how to launch an instance.

The following SageMaker lifecycle configuration installs Theia on your notebook instance and configures the Jupyter server proxy so you can access the IDE alongside your Jupyter notebooks when the instance is running.

For your convenience, I have set example package.json, settings.json, and launch.json files in my github repository to setup Theia. Feel free to adjust the IDE features by following instructions here.

I have set the following line in settings.json so Theia can use the Anaconda environments from the notebook instance:

“python.condaPath”: “/home/ec2-user/anaconda3/condabin/conda”

Create the Theia Lifecycle Configuration

  • Go to SageMaker console
  • Select Lifecycle configurations
  • Go to Create configuration and give it a name.
Image for post
Image for post
  • Copy the script above and paste the content of into Start notebook
Image for post
Image for post
  • Attach the Lifecycle configuration to your instance
Image for post
Image for post

Start your notebook instance and access the IDE

Starting your notebook instance should take roughly 5 minutes. When the instance is InService, you can launch Theia by clicking on the following button:

Image for post
Image for post

You can also chose the python interpreter to be from an Anaconda environment of the Notebook Instance

Image for post
Image for post

Happy coding!

The Startup

Medium's largest active publication, followed by +771K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store