0

I'm trying to link my kaggle project to Google Cloud Platform but I can't seem to get it done even after I followed: https://cloud.google.com/docs/authentication/getting-started

I still get this error:

DefaultCredentialsError: File /C:/Users/Jirah Marie Navarro/kagglebqtest-2999bd391350.json was not found.

This is my code:

    # Replace 'kaggle-competitions-project' with YOUR OWN project id here --  
    PROJECT_ID = 'kagglebqtest'

    from google.cloud import bigquery
    client = bigquery.Client(project=PROJECT_ID, location="US")
    dataset = client.create_dataset('bqml_example', exists_ok=True)

    from google.cloud.bigquery import magics
    from kaggle.gcp import KaggleKernelCredentials
    magics.context.credentials = KaggleKernelCredentials()
    magics.context.project = PROJECT_ID

    # create a reference to our table
    table = client.get_table("kaggle-competition-datasets.geotab_intersection_congestion.train")

    # look at five rows from our dataset
    client.list_rows(table, max_results=5).to_dataframe()
Mikhail Berlyant
  • 165,386
  • 8
  • 154
  • 230
JM Nav
  • 43
  • 6

1 Answers1

0

Seems that the GOOGLE_APPLICATION_CREDENTIALS environment variable is not set correctly.

I suggest you to verify that the 'kagglebqtest-2999bd391350.json' file is in the path 'C:/Users/Jirah Marie Navarro/'.

I recommend you also to use a path without spaces such as 'C:/' or 'C:/credentials/' maybe the JSON credential is not recognized for the spaces in your path, so you can try with something like:

$env:GOOGLE_APPLICATION_CREDENTIALS="C:\credentials/kagglebqtest-2999bd391350.json"
Enrique Zetina
  • 825
  • 5
  • 16