BigQuery错误: AttributeError: ‘ClientOptions’对象没有’api_audience’属性

huangapple go评论54阅读模式
英文:

BigQuery error: AttributeError: 'ClientOptions' object has no attribute 'api_audience'

问题

我在调用BigQuery查询结果的to_dataframe()方法时不断收到这个错误消息:AttributeError: 'ClientOptions'对象没有属性'api_audience'。在同一个虚拟环境中之前可以正常工作,但现在不确定发生了什么。

query.result()没有引发错误,但query.to_dataframe()引发了错误。

这些是我安装的包版本:

  • google-cloud==0.34.0
  • google-cloud-bigquery==2.34.3
  • google-cloud-bigquery-storage==2.16.2
  • google-cloud-core==2.3.2
  • google-cloud-storage==2.7.0
英文:

I keep receiving this error AttributeError: 'ClientOptions' object has no attribute 'api_audience' once I call the to_dataframe() on the query result from BigQuery. This worked fine before using the same virtual env and not sure what's happening now.

query.result() didn't raise errors but query.to_dataframe() raised the error.

These are the packages I have:

google-cloud==0.34.0
google-cloud-bigquery==2.34.3
google-cloud-bigquery-storage==2.16.2
google-cloud-core==2.3.2
google-cloud-storage==2.7.0

答案1

得分: 1

错误可能与google-cloud-core包与其他Google Cloud包之间的版本不兼容有关。

解决这个错误有两种方法之一

pip install --upgrade google-cloud-core

另一种方法是

pip install google-cloud-bigquery==2.29.0

英文:

the error may be related to version incompatibility between the google-cloud-core package and other Google Cloud packages.

there are two ways to solve that error

> pip install --upgrade google-cloud-core

and the other one is a

> pip install google-cloud-bigquery==2.29.0

答案2

得分: 0

我能够重现你的错误,这是当我将google-api-core包降级到2.7.3版本时出现的。

BigQuery错误: AttributeError: ‘ClientOptions’对象没有’api_audience’属性

这个问题可以通过将你的google-api-core升级到2.8.0或更高版本来解决。但是最佳实践是始终保持你的包更新到最新版本。你可以通过运行以下命令将你的包升级到最新版本。

pip install google-api-core --upgrade
英文:

I was able to replicate your error and this is when I downgraded my google-api-core package to 2.7.3.

BigQuery错误: AttributeError: ‘ClientOptions’对象没有’api_audience’属性

This can be resolved by upgrading your google-api-core to 2.8.0 and up. But the BEST PRACTICE is to always keep your packages to the latest version. You may upgrade your package to latest version by running below command.

pip install google-api-core --upgrade

huangapple
  • 本文由 发表于 2023年2月14日 04:08:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/75440706.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定