Run Google Colab Inside VS Code — Complete Step-by-Step Tutorial

Run Google Colab Inside VS Code Complete Step-by-Step Tutorial

Bring Colab’s cloud power and VS Code’s local comfort together.

Google Colab has always been a favourite for quick experiments, data analysis, and machine learning projects, mainly because of its free GPU/TPU runtime and zero setup.

But there’s one limitation: it runs inside the browser.
That means limited extensions, no Git integration, and minimal control over your workspace.

Now, that’s changing.

With the new Google Colab extension for Visual Studio Code (VS Code), you can connect your Colab runtime directly inside VS Code, run your notebooks with Colab’s backend, and still enjoy all of VS Code’s features like IntelliSense, Git, and debugging tools.

Let’s set it up step by step.

Prerequisites

Before you start, make sure you have:

VS Code version 1.105 or later

✅ A Google Account

✅ Internet connection

✅ The Colab .vsix extension file (https://drive.google.com/drive/folders/1zqtRZz97Wou_DpPFEKMtYuGfGGiqbWAL)

Step 1: Install VS Code (if not already)

If you don’t have VS Code yet:

  • Go to https://code.visualstudio.com/
  • Download and install it for your OS.
  • After installation, open it and check the version from
    Help → About (it should be ≥ 1.105).

Step 2: Install the Colab Extension from VSIX

Once you have downloaded the .vsix file (the Colab extension package), install it manually:

Option 1 — From Extensions View

Open VS Code

  1. Click the Extensions icon on the sidebar (or press Ctrl+Shift+X / Cmd+Shift+X)
  2. Click the three dots (…) on the top-right corner of the Extensions panel
  3. Select “Install from VSIX…”
  4. Browse and choose your downloaded .vsix file
  5. Click Install
  6. If prompted, click Reload to restart VS Code

Option 2 — From Command Palette

  1. Press Ctrl+Shift+P (or Cmd+Shift+P on Mac)
  2. Type “Install from VSIX”
  3. Select the command → choose your .vsix file
  4. Install and reload

After reloading, the Colab extension is active.

Step 3: Create a New Jupyter Notebook

  1. In VS Code, click File → New File → Jupyter Notebook,
    or open the Command Palette (Ctrl/Cmd+Shift+P) and select:
    “Create: New Jupyter Notebook”

Step 4: Connect to Colab Kernel

  1. In the top-right corner of the notebook, click “Select Kernel”
  2. You’ll see a list of available kernels — select Colab
  3. It may take a few seconds to connect

Step 5: Sign in with Google (First-Time Auth)

The first time you connect to Colab, you’ll be prompted to sign in.

  1. A browser window opens with the Google sign-in page
  2. Choose your account and allow access
  3. If the first sign-in flow fails, it will offer an alternate OAuth method — try that one
  4. Once authenticated, you’re ready to go!

Step 6: Test Your Setup

In a notebook cell, type:

print("Hello from Colab in VS Code!")

Press Shift + Enter to run.

If you see the output below your cell — congratulations
Your VS Code is now successfully connected to Google Colab!

Step 7: Explore Features

Here’s what you can try now:

Run your existing Colab notebooks directly in VS Code

Use VS Code extensions like Git, Black Formatter, and Python Linter

Access Colab GPUs/TPUs for heavy ML tasks

Manage servers: rename, remove, or add new ones

View your Colab session in the web UI:
Go to Colab → Connect dropdown → Manage sessions

You get Google’s free compute power and VS Code’s professional environment — together.

Conclusion

The new Colab extension for VS Code bridges the gap between cloud and local workflows.
Now, you can write, debug, and run powerful notebooks with Colab’s runtime — right inside your favourite editor.

Whether you’re a data scientist, ML engineer, or student, this setup saves time, improves focus, and boosts productivity.


Run Google Colab Inside VS Code — Complete Step-by-Step Tutorial was originally published in Google Developer Experts on Medium, where people are continuing the conversation by highlighting and responding to this story.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

From brute force to reinforcement: optimizing intelligent agents with modern AI

Next Post

Introducing Metrax: performant, efficient, and robust model evaluation metrics in JAX

Related Posts