google-cloud-python
google-cloud-python copied to clipboard
import of `google.cloud.alloydb` fails when `google-cloud-alloydb-connectors` is installed
The import of google.cloud.alloydb fails when google-cloud-alloydb-connectors 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.alloydb_v1 instead.
See build log here
Steps to reproduce the issue
-
pip install google-cloud-alloydb - Confirm that
python -c "from google.cloud.alloydb import AlloyDBAdminClient"works -
pip install google-cloud-alloydb-connectors - Confirm that
python -c "from google.cloud.alloydb import AlloyDBAdminClient"fails - Confirm that
python -c "from google.cloud.alloydb_v1 import AlloyDBAdminClient"works -
pip uninstall google-cloud-alloydb-connectors - Confirm that
python -c "from google.cloud.alloydb import AlloyDBAdminClient"works
(base) root@a81d841cc16e:/# python3
Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud.alloydb import AlloyDBAdminClient
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'AlloyDBAdminClient' from 'google.cloud.alloydb' (/root/conda/lib/python3.10/site-packages/google/cloud/alloydb/__init__.py)
Marking as P2 since the versioned module imports work.
Use
python -c "from google.cloud.alloydb_v1 import AlloyDBAdminClient"
instead of
python -c "from google.cloud.alloydb import AlloyDBAdminClient"