Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'tqdm' has no attribute 'notebook' error #1378

Closed
tanabata-kitajima opened this issue Oct 5, 2022 · 0 comments · Fixed by #1355
Closed

module 'tqdm' has no attribute 'notebook' error #1378

tanabata-kitajima opened this issue Oct 5, 2022 · 0 comments · Fixed by #1355
Assignees
Labels
api: bigquery Issues related to the googleapis/python-bigquery API.

Comments

@tanabata-kitajima
Copy link

Environment details

  • OS type and version:
    • google colab
    • Linux 224200c9dd15 5.10.133+ chore: add split repo templates #1 SMP Fri Aug 26 08:44:51 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
    • PRETTY_NAME="Ubuntu 18.04.6 LTS"
  • Python version: python --version
    • Python 3.7.14
  • pip version: pip --version
    • pip 21.1.3 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7)
  • google-cloud-bigquery version: pip show google-cloud-bigquery
    • 3.3.3

Steps to reproduce

  1. run this code cell 1 at google colab.
  2. restart google colab runtime.
  3. run this code cell 1 - all
  4. occur error

1-alt: if Cell 1-alt instead of cell 1, no error.

Code example

Cell 1

query = """
SELECT
  name, gender,
  SUM(number) AS total
FROM
  `bigquery-public-data.usa_names.usa_1910_2013`
GROUP BY
  name, gender
ORDER BY
  total DESC
LIMIT
  10
"""
%pip install --upgrade google-cloud-bigquery db-dtypes

Cell 2

from google.cloud import bigquery

from google.colab import auth
import pandas as pd

auth.authenticate_user()
project_id="<your project name>"
pd.read_gbq(query, project_id=project_id, progress_bar_type="tqdm_notebook")

cell 1-alt

query = """
SELECT
  name, gender,
  SUM(number) AS total
FROM
  `bigquery-public-data.usa_names.usa_1910_2013`
GROUP BY
  name, gender
ORDER BY
  total DESC
LIMIT
  10
"""
#%pip install --upgrade google-cloud-bigquery db-dtypes

Stack trace

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-3-e0e6ef23fa30>](https://localhost:8080/#) in <module>
      1 auth.authenticate_user()
      2 project_id="<your project name>"
----> 3 pd.read_gbq(query, project_id=project_id, progress_bar_type="tqdm_notebook")

6 frames
[/usr/local/lib/python3.7/dist-packages/pandas/io/gbq.py](https://localhost:8080/#) in read_gbq(query, project_id, index_col, col_order, reauth, auth_local_webserver, dialect, location, configuration, credentials, use_bqstorage_api, max_results, progress_bar_type)
    192         configuration=configuration,
    193         credentials=credentials,
--> 194         **kwargs,
    195     )
    196 

[/usr/local/lib/python3.7/dist-packages/pandas_gbq/gbq.py](https://localhost:8080/#) in read_gbq(query, project_id, index_col, col_order, reauth, auth_local_webserver, dialect, location, configuration, credentials, use_bqstorage_api, max_results, verbose, private_key, progress_bar_type)
    965         configuration=configuration,
    966         max_results=max_results,
--> 967         progress_bar_type=progress_bar_type,
    968     )
    969 

[/usr/local/lib/python3.7/dist-packages/pandas_gbq/gbq.py](https://localhost:8080/#) in run_query(self, query, max_results, progress_bar_type, **kwargs)
    530             query_reply,
    531             max_results=max_results,
--> 532             progress_bar_type=progress_bar_type,
    533         )
    534 

[/usr/local/lib/python3.7/dist-packages/pandas_gbq/gbq.py](https://localhost:8080/#) in _download_results(self, query_job, max_results, progress_bar_type)
    560                 dtypes=nullsafe_dtypes,
    561                 bqstorage_client=bqstorage_client,
--> 562                 progress_bar_type=progress_bar_type,
    563             )
    564         except self.http_error as ex:

[/usr/local/lib/python3.7/dist-packages/google/cloud/bigquery/table.py](https://localhost:8080/#) in to_dataframe(self, bqstorage_client, dtypes, progress_bar_type, create_bqstorage_client, geography_as_object)
   1980             progress_bar_type=progress_bar_type,
   1981             bqstorage_client=bqstorage_client,
-> 1982             create_bqstorage_client=create_bqstorage_client,
   1983         )
   1984 

[/usr/local/lib/python3.7/dist-packages/google/cloud/bigquery/table.py](https://localhost:8080/#) in to_arrow(self, progress_bar_type, bqstorage_client, create_bqstorage_client)
   1776         try:
   1777             progress_bar = get_progress_bar(
-> 1778                 progress_bar_type, "Downloading", self.total_rows, "rows"
   1779             )
   1780 

[/usr/local/lib/python3.7/dist-packages/google/cloud/bigquery/_tqdm_helpers.py](https://localhost:8080/#) in get_progress_bar(progress_bar_type, description, total, unit)
     50             return tqdm.tqdm(desc=description, total=total, unit=unit)
     51         elif progress_bar_type == "tqdm_notebook":
---> 52             return tqdm.notebook.tqdm(desc=description, total=total, unit=unit)
     53         elif progress_bar_type == "tqdm_gui":
     54             return tqdm.tqdm_gui(desc=description, total=total, unit=unit)

AttributeError: module 'tqdm' has no attribute 'notebook'
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants