python - Airflow 1.10.9 - 无法从 '_check_google_client_version' 导入名称 'pandas_gbq.gbq'

标签 python pandas google-bigquery airflow

我目前在 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 导入 _check_google_client_version从 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 吗?

最佳答案

为了以可重复的方式安装 Airflow ,您需要遵循带有约束的方法:http://airflow.apache.org/docs/apache-airflow/stable/installation.html#installation-script - 请注意,您使用的是相当旧版本的 Airflow,因此 1.10.9 的约束会相当旧,我建议您升级到更高版本的 Airflow。
您也可以自己从安装 pip freeze > constraint.txt 准备这样的约束文件,然后您可以修改该文件并将 pandas_gbq 设置为 0.14.1(然后使用带有 --constraint 标志的约束文件)。这将为您提供您已经拥有的依赖项的确切版本,并强制为 pandas-gbq 安装 0.14.1

关于python - Airflow 1.10.9 - 无法从 '_check_google_client_version' 导入名称 'pandas_gbq.gbq',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66990397/

相关文章:

javascript - 在 Django 中处理没有表单的 Ajax 请求

python - 将空格转换为列表中的 %20

python - pandas - 从列中提取大于阈值的值

python - 在 Python Pandas DataFrame 中保留列顺序

Elasticsearch 到 BigQuery 管道部署在云数据融合实例上失败

sql - "Error: Unexpected, Please Try Again"与 GoogleBigQuery JOIN

python - 在列表理解期间使用附加更改列表

python - SQLAlchemy ORM : create 2 attributes for the same column

python - 访问列表中第一个元素以外的元素不起作用

java - 有没有办法使用 java 驱动程序为大查询创建基于非摄取时间的分区表?