Jupyter Notebook is easy mode with DevPod

4 min read

With all of the hype around AI/ML there has never been a better time to get started with Jupyter Notebook. This Open Source tool is great for configuring workflows in data science, scientific computing, and machine learning. 

DevPod has added Jupyter Notebook as an IDE. Now you can share your work with others by adding a devcontainer to your repository and even an “Open in DevPod” button. These features reduce the overhead in figuring out how to share and collaborate. With DevPod and devcontainers you can ensure that each user has the same experience when they open your project.

With the intro out of the way let’s walk through a basic workflow using everyone’s favorite example: Hello, World!

#Get Started with DevPod

We will start by installing DevPod. We’re going to provide a link to the getting started guide instead of listing out all of the steps here. Head over to the docs and install DevPod, and then we’ll move on to the next section.

https://devpod.sh/docs/getting-started/install

#Create a Provider for Docker

At this point, we will assume that Docker has already been installed on your machine. If not, go ahead and follow the guide on getting Docker Desktop installed or if you are using another provider in DevPod, such as Kubernetes, go ahead and create a provider. 

Docker Desktop: https://www.docker.com/products/docker-desktop/

Provider Documentation: https://devpod.sh/docs/managing-providers/add-provider

Within DevPod, select the Providers option and then select the “+ Add” option. In the popup, select Docker and then “Add Provider.” There are other options within the provider that you can configure, however for the guide, we will leave everything default, and it should work out of the box if you have Docker running locally.

DevPod Docker Add Provider

Anything we launch using the Docker provider will bring up a new container within Docker on our local machine. This is great when you want to work locally on something and may not need the amount of resources a provider like Kubernetes or a VM would provide.

Now that we have a target for our workspace, we can move on to the next section.

#Create a Workspace with Jupyter Notebook as the IDE

Now that we have DevPod installed and somewhere local to launch the container (Docker), we can move on to opening the example repository. 

We will start out by creating a Workspace. In this step, we will use the example repository https://github.com/mpetason/jupyter-notebook and set our IDE as Jupyter Notebook. Once we select “Create Workspace” DevPod will pull the repository and run some magic in the background which will result in Jupyter Notebook launching in your default browser.

If you want to skip the manual configuration, there is an “Open in DevPod” in the repository, which will open up DevPod with the information filled in for you. Verify that Jupyter Notebook is selected as you may have defined a default IDE.

Here is an example of what DevPod will look like once you fill in the required fields for the Workspace. In this example, we can skip filling in any additional fields like Workspace Name or Prebuild Repository. 

DevPod Jupyter Notebook Workspace

Once we click “Create Workspace” you’ll be able to watch the build happen. The logs in this section are useful for checking the status and troubleshooting if any issues come up. If you run into any issues and the logs are not verbose enough, there is an option to enable debug mode in the Settings section in the navigation bar. 

If you are adding a .devcointainer to an already existing repository that you have been using, then debug mode will be your go-to for troubleshooting container builds, startup, or other steps in the build process.

DevPod Jupyter Notebook Startup

After everything has been built successfully, Jupyter Notebook will launch in your default browser. Here is our example repository with a README.md and our hello_world notebook. Double-click the notebook (.ipynb file) to open it in another tab.

DevPod Jupyter Notebook UI

Now we can see the code written within the notebook. This example is very simple, it’s just going to print out “Hello World!” when you select the play button or the restart kernel option. Select one of those options and then you have completed your first Jupyter Notebook example!

Jupyter Notebook Hello World

#Needs More Power

Running everything locally is great, but at some point you may want to move your workload to something with a bit more power. This is where the multiple provider options come in. One of the popular providers is Kubernetes. The workflow is the same as with Docker, except you will create a Kubernetes provider and then select Kubernetes as the provider when creating a Workspace.

Here’s a link to the provider documentation in case you missed it earlier in the post:

https://devpod.sh/docs/managing-providers/add-provider

#Conclusion

Jupyter Notebook was recently added as an IDE in DevPod v0.3. If you want to see it in action, here’s a short video showing it off, as well as Dark Mode and Fleet.

Sign up for our newsletter

Be the first to know about new features, announcements and industry insights.