Registry / gcp / google-cloud-tpu

google-cloud-tpu

JSON →
library1.26.0pypypi✓ verified 83d ago

Client library for the Google Cloud TPU API, which allows management of Cloud TPU resources. Current version 1.26.0, requires Python >=3.9. Released as part of google-cloud-python monorepo with regular weekly releases.

pip install google-cloud-tpu
INSTALL
IMPORT
SIG · GOOGLE-CLOUD-TPU
G
google-cloud-tpu
gcppythonv1.26.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TpuClient
from google.cloud import tpu
from google.cloud.tpu_v1 import TpuClient
Use the generic namespace package; specific versions like tpu_v1 are internal and may change.

Initialize TPU client and list nodes in a project/location. Requires authentication via Application Default Credentials or service account.

from google.cloud import tpu client = tpu.TpuClient() parent = f"projects/{os.environ.get('PROJECT_ID', '')}/locations/us-central1" nodes = client.list_nodes(parent=parent) print(nodes)
Debug
Known issues
deprecatedThe `google-cloud-tpu` library uses the v2alpha1 API by default; some resource fields may be unstable. For production, pin to a specific API version (e.g., v2).
fix
Use `from google.cloud.tpu_v2 import TpuClient` instead of the generic namespace.
affects: all
gotchaDo not use `google.cloud.tpu_v1` – it is outdated and does not reflect current TPU features. Prefer v2 or v2alpha1.
fix
Use `from google.cloud import tpu` or `from google.cloud.tpu_v2 import TpuClient`.
affects: all
breakingPython 3.9 support was dropped after version 1.21.0. Ensure you use Python >=3.10 for versions >=1.22.0.
fix
Upgrade Python to 3.10 or later, or pin to google-cloud-tpu==1.21.0.
affects: >=1.22.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'google.cloud.tpu'
The package is not installed or import path is incorrect.
fix
Run 'pip install google-cloud-tpu' and import as 'from google.cloud import tpu'.
AttributeError: module 'google.cloud.tpu' has no attribute 'TpuClient'
Importing from old or incorrect submodule (e.g., google.cloud.tpu_v1).
fix
Use 'from google.cloud import tpu' and then 'client = tpu.TpuClient()'.
google.api_core.exceptions.PermissionDenied: 403 The caller does not have permission
Incorrect or missing authentication credentials, or the service account lacks TPU permissions.
fix
Set GOOGLE_APPLICATION_CREDENTIALS to a service account key with roles/tpu.admin or use ADC with appropriate scopes.
Upgrade
Version history
1.26.0latest on PyPI · released Mar 26, 2026
Audit
Dependencies
google-api-corerequiredRequired for client lifecycle and transport
google-authrequiredAuthentication
grpc-google-common-protosoptionalProtobuf definitions for common protos
proto-plusrequiredMessage encoding/decoding
Agent activity
26 hits · last 30 days
node
20
OpenAI (training)
1
Resources
google-cloud-tpu — pip install google-cloud-tpu · libregistry