0

I knew that BigQuery module is already installed on datalab. I just wanna to use bq_helper module because I learned it on Kaggle.

I did !pip install -e git+https://github.com/SohierDane/BigQuery_Helper#egg=bq_helper and it worked.

but I can't import the bq_helper. The pic is shown below.

enter image description here

Please help. Thanks!

I used python2 on Datalab.

Ekaba Bisong
  • 2,918
  • 2
  • 23
  • 38
Yu-Long Tsai
  • 105
  • 1
  • 2
  • 7

1 Answers1

1

I am not familiar with the BigQuery Helper library you shared, but in general, in Datalab, it may happen that you need to restart the kernel in order for the libraries to be properly loaded.

I reproduced the scenario you proposed: installing the library with the command !pip install -e git+https://github.com/SohierDane/BigQuery_Helper#egg=bq_helper and then trying to import it in the notebook using:

from bq_helper import BigQueryHelper

bq_assistant = BigQueryHelper("bigquery-public-data", "github_repos")
bq_assistant.project_name

At first, it did not work and I obtained the same error as you; then I clicked on the Reset Session button and the library was loaded properly.

enter image description here

Some other details that may be relevant if this does not work for you are:

  • I am also running on Python2 (although the GitHub page of the library suggests that it was only tested in Python3.6+).
  • The Custom metadata parameters in the Datalab GCE instance are: created-with-datalab-version: 20180503 and created-with-sdk-version: 208.0.2.
dsesto
  • 7,864
  • 2
  • 33
  • 50
  • Finally, I've done it. It worked initially...... It's sad that another issue about 'Client' object does not connect well. I'm wondering the same thing as you mentioned the pyenv. Although Datalab provide a py3 envir but it's still py3.5 =( – Yu-Long Tsai Jul 21 '18 at 09:24
  • Hi @Yu-LongTsai . From your message I understand that my answer helped you solve your issues, so I invite you to consider [accepting and/or upvoting](https://stackoverflow.com/help/someone-answers) my answer so that the community sees it solved your issue. I also see you mentioned a new issue with a "Client". As per StackOverflow best practices, I would suggest to open a new question to track new issues, if those are not directly related to this one. Thanks in advance! – dsesto Jul 22 '18 at 10:03