【问题标题】:Airflow 1.10.9 - cannot import name '_check_google_client_version' from 'pandas_gbq.gbq'Airflow 1.10.9 - 无法从“pandas_gbq.gbq”导入名称“_check_google_client_version”
【发布时间】:2021-07-03 12:30:33
【问题描述】:

我目前在 ECS 上使用 Airflow 1.10.9。我在 requirements.txt 文件中明确指定 Airflow 版本,如下所示。

apache-airflow[aws,celery,crypto,gcp,jdbc,mysql,password,postgres,slack,statsd]==1.10.9

pandas_gbq.gbq 0.15.0 发布后,我们的 Airflow 集群在 Web UI 上出现了这个错误。

cannot import name '_check_google_client_version' from 'pandas_gbq.gbq'

这是因为 bigquery_hook import _check_google_client_version from pandas_gbq 但从 0.15.0 起已被删除。

https://github.com/apache/airflow/blob/1.10.9/airflow/contrib/hooks/bigquery_hook.py#L40

https://github.com/pydata/pandas-gbq/blob/0.14.1/pandas_gbq/gbq.py#L37 https://github.com/pydata/pandas-gbq/blob/0.15.0/pandas_gbq/gbq.py

我尝试通过如下指定 pandas-gbq 的版本来安装 pandas_gbq 0.14.1,但它不起作用。容器上安装了 pandas-gbq 0.15.0。

pandas==0.25.3
pandas-gbq==0.14.1
apache-airflow==1.10.9

你能帮我在我的 Airflow 容器上安装 pandas-gbq 0.14.1 吗?

【问题讨论】:

标签: python pandas google-bigquery airflow


【解决方案1】:

为了以可重复的方式安装气流,您需要遵循带有约束的方法:http://airflow.apache.org/docs/apache-airflow/stable/installation.html#installation-script - 请注意,您使用的是相当旧版本的气流,因此 1.10.9 约束将相当旧,我建议您升级到更高版本的 Airflow。

您也可以从安装 pip freeze > constraints.txt 中自己准备这样的约束文件,然后您可以修改文件并将 pandas_gbq 设置为 0.14.1(然后将该约束文件与 --constraint 标志一起使用)。这将为您提供您已经拥有的依赖项的确切版本,并为 pandas-gbq 强制安装 0.14.1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-02-27
    • 2020-09-22
    • 2021-12-04
    • 2021-05-30
    • 2021-11-07
    • 2021-03-07
    • 2021-04-27
    相关资源
    最近更新 更多