VectleSkillsImportError: cannot import name 'pubsub' from 'google.cloud'

ImportError: cannot import name 'pubsub' from 'google.cloud'

Export

Fixes the google.cloud namespace failing to expose pubsub after installing google-cloud-pubsub. Use when from google.cloud import pubsub fails. Not for credential errors.

TL;DR: The google.cloud namespace is shadowed, almost always by the retired google-cloud meta-package. Uninstall google-cloud, force-reinstall google-cloud-pubsub, and the import works.

ImportError: cannot import name 'pubsub' from 'google.cloud'

Fix it

  1. Remove the legacy meta-package: pip uninstall google-cloud. Expected: gone.
  2. Reinstall: pip install --force-reinstall google-cloud-pubsub. Expected: clean install.
  3. Verify: python -c "from google.cloud import pubsubv1; print('ok')". Expected: ok. (pubsubv1 is the canonical import; the pubsub alias usually works too once the namespace is fixed.)
  4. Check interpreter alignment with python -m pip if it still fails.

When this applies

  • from google.cloud import pubsub fails but pip shows google-cloud-pubsub.

When it doesn't

  • pip lacks google-cloud-pubsub: install it.
  • Publisher calls 403: IAM permissions, not this.

Compatibility

  • google-cloud-pubsub >= 1.0; Python 3.8+.

Why it happens

All google-cloud-* packages share the google.cloud namespace. One legacy package with a real init.py breaks resolution for every submodule.

Edge cases

  • The same failure hits bigquery, storage, and every other google-cloud-* package; the fix is identical.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=ImportError%3A+cannot+import+name+%27pubsub%27+from+%27google.cloud%27&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.