Repository navigation
Description
Bug Report: google.colab.drive.mount() Fails in VSCode with Colab Extension
Description
The google.colab.drive.mount() function fails when executing notebooks in VSCode using the Colab extension. This prevents users from mounting Google Drive to access files, which is a core feature of Google Colab notebooks. The function raises a ValueError: mount failed without providing information about whether this feature is unsupported or if it's a bug.
Environment
- VS Code version: 1.106.0
- Colab extension version: [Check in VSCode Extensions panel]
- Jupyter extension version: [Check in VSCode Extensions panel]
- OS: Mac (Darwin 25.1.0, arm64)
Repro Steps
- Open a Jupyter notebook (.ipynb) in VSCode with the Colab extension installed
- Create a code cell with the following content:
from google.colab import drive
drive.mount('/content/drive')- Execute the cell
- Observe the ValueError
Expected Behaviour
One of the following should occur:
- Successfully mount Google Drive to the specified path (if supported)
- Provide a clear error message indicating that Drive mounting is not supported in VSCode environment
- Offer an alternative method or graceful fallback for file access
Actual Behaviour
The function fails with a generic error that doesn't indicate whether this is unsupported or a bug:
ValueError Traceback (most recent call last)
/tmp/ipython-input-43171240.py in <cell line: 0>()
17 # Montagem do Google Drive
18 from google.colab import drive
---> 19 drive.mount('/content/drive')
20
21 # Configurações
/usr/local/lib/python3.12/dist-packages/google/colab/drive.py in mount(mountpoint, force_remount, timeout_ms, readonly)
95 def mount(mountpoint, force_remount=False, timeout_ms=120000, readonly=False):
96 """Mount your Google Drive at the specified mountpoint path."""
---> 97 return _mount(
98 mountpoint,
99 force_remount=force_remount,
/usr/local/lib/python3.12/dist-packages/google/colab/drive.py in _mount(mountpoint, force_remount, timeout_ms, ephemeral, readonly)
270 'https://research.google.com/colaboratory/faq.html#drive-timeout'
271 )
--> 272 raise ValueError('mount failed' + extra_reason)
273 elif case == 4:
274 # Terminate the DriveFS binary before killing bash.
ValueError: mount failed
Additional Context
- The same notebook runs successfully in Google Colab (browser version)
- The
google.colabpackage appears to be installed at/usr/local/lib/python3.12/dist-packages/google/colab/drive.py - This breaks compatibility with existing Colab notebooks that rely on Drive integration
- Users need to manually modify notebooks to work in VSCode, defeating the purpose of seamless Colab integration
Logs
Logs from Colab
Logs from Colab in the Output panel (View > Output, change the drop-down the upper-right of the Output panel to Colab).
[You need to copy the logs from VSCode - View > Output > Select "Colab" from dropdown]
Logs from Jupyter
Logs from Jupyter in the Output panel (View > Output, change the drop-down the upper-right of the Output panel to Jupyter).
[You need to copy the logs from VSCode - View > Output > Select "Jupyter" from dropdown]
Activity
google.colablibraries (e.g.userdate.get) are unsupported (for now!) #215