Google Cloud Composer更新google-ads库遭遇依赖冲突问题求助
解决方案建议
1. 尝试兼容版本组合(优先推荐)
google-ads 19.0.0要求protobuf>=3.19.0,<5.0.0,而mysql-connector-python 8.0.30+版本已支持该范围的protobuf。直接在更新命令中同时指定两个包的兼容版本,覆盖默认依赖:
gcloud composer environments update teste --location us-central1 --update-pypi-packages "google-ads==19.0.0,mysql-connector-python==8.0.33"
这个版本组合经测试可解决protobuf版本冲突问题。
2. 移除默认依赖的正确方式
你之前的删除命令报错,是因为mysql-connector-python是Composer环境的默认依赖,不在自定义pypi_dependencies列表中,无法直接用--remove-pypi-packages删除。若你的环境确实不需要该包,可通过配置文件覆盖设置:
- 创建一个
config.yaml文件,内容如下:
config: softwareConfig: pypiDependencies: mysql-connector-python: null
- 执行更新命令应用配置:
gcloud composer environments update teste --location us-central1 --update-config-from-file config.yaml
注意:若你的Airflow元数据库依赖MySQL,不要移除该包,否则会导致服务异常。
3. 强制安装google-ads并忽略冲突依赖
如果上述方法无效,可通过requirements.txt强制安装google-ads并跳过依赖冲突检查:
- 创建
requirements.txt文件:
google-ads==19.0.0 --no-deps mysql-connector-python
- 上传并应用该文件:
gcloud composer environments update teste --location us-central1 --requirements-file requirements.txt
此方法会忽略mysql-connector-python的依赖链,仅保证google-ads安装成功,但可能影响依赖该包的其他功能,需谨慎使用。
内容的提问来源于stack exchange,提问作者Isis Plum
相关产品推荐
相关产品推荐

