Connect Gdrive on a remote computer

I am working on a remote workstation and would like to pull data. I can copy and past that link

dvc pull
  0% Querying remote cache|                                                                                                                                                                                       |0/1 [00:00<?,    ?files/s]Your browser has been opened to visit:

    https://accounts.google.com/o/oauth2/...

into my local browser and login allow access, but then the token is not transfered to the remote machine, which gets stuck.

To clarify, I am logged in to a workstation via ssh and want to pull the data to that workstation, while the data repository is on GDrive. I want to execute all commands on that workstation remotely and I don’t want to use that workstation as my data-repo.

Hi, rmbzmb
Could you please provide some more detailed logs through

dvc pull -vv

And some more DVC info through

dvc doctor

The following I tried locally and it worked, however, when I executed the same steps on the remote workstation I get errors below. I am using the same json file though.

dvc remote modify storage gdrive_use_service_account true
dvc remote modify storage --local gdrive_service_account_json_file_path .dvc/gdrive-access.json
dvc pull

ERROR: unexpected error - <HttpError 403 when requesting https://www.googleapis.com/drive/v2/files/…?fields=driveId&supportsAllDrives=true&alt=json returned “Access Not Configured. Drive API has not been used in project … before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=...then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.”. Details: “[{‘domain’: ‘usageLimits’, ‘reason’: ‘accessNotConfigured’, ‘message’: ‘Access Not Configured. Drive API has not been used in project … before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=… then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.’, ‘extendedHelp’: ‘https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=…’}]”>

dvc pull -vv

------------------------------------------------------------
2022-07-18 03:34:29,370 DEBUG: Version info for developers:
DVC version: 2.13.0 (pip)
---------------------------------
Platform: Python 3.9.13 on Linux-5.4.0-113-generic-x86_64-with-glibc2.31
Supports:
        gdrive (pydrive2 = 1.10.1),
        hdfs (fsspec = 2022.5.0, pyarrow = 8.0.0),
        webhdfs (fsspec = 2022.5.0),
        http (aiohttp = 3.8.1, aiohttp-retry = 2.5.2),
        https (aiohttp = 3.8.1, aiohttp-retry = 2.5.2)
Cache types: <https://error.dvc.org/no-dvc-cache>
Caches: local
Remotes: gdrive
Workspace directory: ext4 on /dev/mapper/ubuntu--vg-root
Repo: dvc, git

Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!
2022-07-18 03:34:29,372 DEBUG: Analytics is enabled.
2022-07-18 03:34:29,426 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp5jdm7j8x']'
2022-07-18 03:34:29,429 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp5jdm7j8x']'

When I visit that google URL I am getting an error: You do not have sufficient permissions to view this page. Apparently, Chrome uses the wrong account and there is no option to change the account.

Finally, it works. One of the things I had to do was to share the Gdrive folder containing the registry with the service account email with read/write permissions. It is not enough to create the service account. Though I am not sure why with the same JSON file, I get write permissions on one computer, but not on another computer. Maybe because I authenticated the first computer with the web-form.

1 Like