google-cloud-python icon indicating copy to clipboard operation
google-cloud-python copied to clipboard

import of `google.cloud.alloydb` fails when `google-cloud-alloydb-connectors` is installed

Open parthea opened this issue 2 years ago • 0 comments

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

  1. pip install google-cloud-alloydb
  2. Confirm that python -c "from google.cloud.alloydb import AlloyDBAdminClient" works
  3. pip install google-cloud-alloydb-connectors
  4. Confirm that python -c "from google.cloud.alloydb import AlloyDBAdminClient" fails
  5. Confirm that python -c "from google.cloud.alloydb_v1 import AlloyDBAdminClient" works
  6. pip uninstall google-cloud-alloydb-connectors
  7. 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"

parthea avatar Dec 07 '23 13:12 parthea