google-cloud-python
google-cloud-python copied to clipboard
import of `google.cloud.billing` fails when `google-cloud-billing-budgets` is installed
The import of google.cloud.billing fails when google-cloud-billing-budgets is installed in the same environment. The issue is similar to https://github.com/googleapis/google-cloud-python/issues/11399. As a workaround use google.cloud.billing_v1 instead.
See build log here
Steps to reproduce the issue
-
pip install google-cloud-billing - Confirm that
python -c "from google.cloud.billing import CloudBillingClient"works -
pip install google-cloud-billing-budgets - Confirm that
python -c "from google.cloud.billing import CloudBillingClient"fails - Confirm that
python -c "from google.cloud.billing_v1 import CloudBillingClient"works -
pip uninstall google-cloud-billing-budgets - Confirm that
python -c "from google.cloud.billing import CloudBillingClient"works
(base) root@a81d841cc16e:/# python -c "from google.cloud.billing import CloudBillingClient"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name 'CloudBillingClient' from 'google.cloud.billing' (/root/conda/lib/python3.10/site-packages/google/cloud/billing/__init__.py)
Marking as P2 since the versioned module imports work.
Use
python -c "from google.cloud.billing_v1 import CloudBillingClient"
instead of
python -c "from google.cloud.billing import CloudBillingClient"