Skip to content

How do I access local files from colab kernel? #210

Description

@aribornstein

Description

When using the Google Colab extension in VS Code, the remote Colab runtime cannot access local files.
Even when the notebook is stored locally and opened in VS Code, selecting the Colab kernel prevents file reads such as pd.read_csv("localfile.csv").
The Files pane does not reliably upload files, and local paths cannot be resolved.

This makes it unclear how (or if) local file access is supposed to work with Colab kernels in VS Code.

Environment

  • VS Code version: **1.106.0 **
  • Colab extension version: 0.0.x
  • Jupyter extension version: 2024.x.x
  • OS (Linux | Mac | Windows): Mac

Repro Steps

  1. Open a local folder in VS Code.

  2. Open a local .ipynb file.

  3. Switch the kernel to Colab › Connect to a hosted runtime.

  4. Attempt to read any local file, e.g.:

    open("test.txt").read()
  5. Or attempt to upload a file via the Files sidebar.

Expected Behaviour

  • The extension should either:

    • provide a reliable way to upload / sync local files into the Colab runtime, or
    • clearly indicate that local files are not accessible when using a remote kernel.
  • File uploads should appear consistently under /content/.

Actual Behaviour

  • Local file paths are not found.
  • Upload button in the Files sidebar sometimes does nothing or silently fails.
  • No clear instructions are given on how to access local data.
  • The behaviour is inconsistent with the blog post announcement, which implies local notebooks can interact with Colab runtimes.

Additional context

This issue makes it challenging to work with local datasets while using Colab GPU runtimes through VS Code.
The documentation does not explain the limitations of local file access when using the remote runtime.

Logs

Colab Output Panel

# Paste your Colab logs here
# e.g. FileNotFoundError, connection messages, etc.

Jupyter Output Panel

# Paste your Jupyter logs here

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions