Warm tip: This article is reproduced from stackoverflow.com, please click
google-drive-api jupyter-notebook python google-colaboratory

How to use Google Colab local runtime and connect to Google Drive

发布于 2020-04-07 23:21:50

I am running Google Colab with a local runtime. I use this command to start Jupyter:

jupyter notebook  --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888  --NotebookApp.port_retries=0

When I previously connected I was able to mount Google Drive with this code in the notebook:

from google.colab import drive
drive.mount('/content/drive')

I was able to connect to Google Drive and access files while on local runtime. However, now I am getting this error:

ModuleNotFoundError: No module named 'google.colab'

I see other people have this problem, and some suggest using PyDrive. But I am certain I was connected to Google Drive without using PyDrive.

I suspect the first command I ran to start Jupyter was different when Google Drive was able to connect. Is there a specific flag I have to add to that first command

Questioner
Rish
Viewed
756
Bob Smith 2020-02-01 05:07

The google.colab libraries only exist on managed backends.

When running on your local machine, you'll want to instead use Drive's existing sync apps available here: https://www.google.com/drive/download/