dvc: DVC+Google Cloud: Could not automatically determine credentials (GOOGLE_APPLICATION_CREDENTIALS not set)
Trying to run dvc pull
with a Google Cloud remote, got this error message:
ERROR: unexpected error - Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started
gsutil ls gs://my_bucket
worked fine.
Running gcloud auth login
didn’t help, but gcloud beta auth application-default login
solved the problem.
$ echo ${GOOGLE_APPLICATION_CREDENTIALS}
$ dvc --version
0.77.3
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
DVC was installed using sudo pip install dvc[all]
.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 24 (12 by maintainers)
I had the error below when I tried to push to a newly created GS remote, while regular
gsutil
commands worked fine.gcloud auth login
didn’t fix the problem, butgcloud beta auth application-default login
did.Huge thanks to @pmrowla for helping me figure this out!
I think this resolved it for me
export GOOGLE_APPLICATION_CREDENTIALS="/Path/to/my/keyfile.json"
where this is the JSON key file generated for the google service account.Hopefully this monologue is helpful to someone!
Feels like @Suor can help with that. Sorry for such a late response, I’ve missed the notification.
My 2cts: For someone used to S3 remotes, the GCP track is much more painful. It seems like using a GCP bucket is very different than one on S3.
@vade I tried to “play” with this a little bit more … could you please, try to use
dvc remote modify storage credentialpath /Path/to/my/keyfile.json
for the service accountwhere
keyfile.json
is credentials file for the service account that has proper access.that alone worked for me.
Though env variable should be fine also.
I’ll review the docs PR and probably simplify a bit (to put links to the Google official auth docs mostly instead of replicating auth flow on our end).