{"id":2049,"library":"google-cloud-artifact-registry","title":"Google Cloud Artifact Registry","description":"The `google-cloud-artifact-registry` client library for Python allows developers to interact with Google Cloud Artifact Registry. This service provides a universal package manager for various artifact formats, including Docker images, Maven artifacts, npm packages, and more. The library is currently at version 1.21.0 and is part of the actively maintained Google Cloud Python client libraries, receiving frequent updates.","status":"active","version":"1.21.0","language":"python","source_language":"en","source_url":"https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-artifact-registry","tags":["Google Cloud","Artifact Registry","client library","package manager","GCP"],"install":[{"cmd":"pip install google-cloud-artifact-registry","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"ArtifactRegistryClient","correct":"from google.cloud.artifactregistry_v1 import ArtifactRegistryClient"},{"note":"Use the async client for non-blocking I/O operations.","symbol":"ArtifactRegistryAsyncClient","correct":"from google.cloud.artifactregistry_v1 import ArtifactRegistryAsyncClient"}],"quickstart":{"code":"import os\nfrom google.cloud.artifactregistry_v1 import ArtifactRegistryClient\n\ndef list_repositories(project_id: str, location: str):\n    \"\"\"Lists repositories in a given project and location.\"\"\"\n    client = ArtifactRegistryClient()\n    # The parent resource name for the project and location\n    parent = f\"projects/{project_id}/locations/{location}\"\n\n    try:\n        print(f\"Listing repositories in {parent}...\")\n        # list_repositories returns an iterator, common for Google Cloud APIs\n        repositories = client.list_repositories(parent=parent)\n        found = False\n        for repo in repositories:\n            print(f\"- {repo.name} (Format: {repo.format.name}, Description: {repo.description})\")\n            found = True\n        if not found:\n            print(\"No repositories found.\")\n    except Exception as e:\n        print(f\"Error listing repositories: {e}\")\n\nif __name__ == \"__main__\":\n    # Set these environment variables or replace the placeholders\n    PROJECT_ID = os.environ.get(\"GCP_PROJECT_ID\", \"your-gcp-project-id\")\n    LOCATION = os.environ.get(\"GCP_LOCATION\", \"us-central1\") # e.g., 'us-central1', 'europe-west1'\n\n    if PROJECT_ID == \"your-gcp-project-id\":\n        print(\"Please set the GCP_PROJECT_ID environment variable or replace 'your-gcp-project-id'.\")\n        print(\"Also ensure you are authenticated (e.g., `gcloud auth application-default login`).\")\n    else:\n        list_repositories(PROJECT_ID, LOCATION)\n","lang":"python","description":"This quickstart demonstrates how to initialize the `ArtifactRegistryClient` and list repositories within a specified Google Cloud project and location. It highlights the use of `parent` resource names and iterating over paginated results."},"warnings":[{"fix":"Always specify the correct `location` parameter in your API calls, typically in the `parent` resource name string (e.g., `projects/{project_id}/locations/{location}`).","message":"Artifact Registry resources (repositories, packages, artifacts) are regional. Operations like listing or creating repositories must specify a valid `location` (e.g., 'us-central1', 'europe-west1'). Forgetting this or using an incorrect region will result in 'NotFound' or 'PermissionDenied' errors, even if the resource exists in another region.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure that resource name strings are constructed precisely according to the API documentation. For instance, `client.repository_path(project, location, repository_id)` can be used to generate the correct format.","message":"Many Artifact Registry API calls require fully qualified resource names (e.g., `projects/PROJECT_ID/locations/LOCATION/repositories/REPOSITORY_ID`). Incorrectly formatting these strings is a common source of `INVALID_ARGUMENT` or `NotFound` errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Verify that the environment has access to valid credentials and that the principal (user or service account) has the necessary IAM roles (e.g., 'Artifact Registry Reader' or 'Artifact Registry Administrator') for the resources it's attempting to access.","message":"The client library uses Application Default Credentials for authentication. If your code is running outside of Google Cloud (e.g., on a local machine), you must explicitly authenticate (e.g., via `gcloud auth application-default login`) or set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable. Incorrect setup often leads to `google.auth.exceptions.DefaultCredentialsError` or `PermissionDenied` errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.21.0':50 'activ':56 'allow':15 'artifact':3,9,22,33,39,68 'client':11,61,70 'cloud':2,8,21,59,67 'current':47 'develop':16 'docker':36 'format':34 'frequent':64 'gcp':74 'googl':1,7,20,58,66 'google-cloud-artifact-registri':6 'imag':37 'includ':35 'interact':18 'librari':12,45,62,71 'maintain':57 'manag':30,73 'maven':38 'npm':40 'packag':29,41,72 'part':53 'provid':26 'python':14,60 'receiv':63 'registri':4,10,23,69 'servic':25 'univers':28 'updat':65 'various':32 'version':49","created_at":"2026-04-09T18:41:20.149150+00:00","updated_at":"2026-04-16T15:19:31.347180+00:00","problems":[{"fix":"Ensure the service account or user has the appropriate IAM roles (e.g., `Artifact Registry Reader` for pulling, `Artifact Registry Writer` for pushing) on the target repository. For Docker, run `gcloud auth configure-docker <REGION>-docker.pkg.dev` to refresh credentials. For Python packages, ensure `keyrings.google-artifactregistry-auth` is installed and configured, or pass credentials via `gcloud artifacts print-settings python`.","cause":"This error typically indicates that the authenticated user or service account lacks the necessary IAM permissions to perform the requested operation (e.g., push, pull, list) on the Artifact Registry repository, or the authentication configuration (e.g., Docker credentials) is incorrect or expired.","error":"403 Forbidden"},{"fix":"Install the library using pip: `pip install google-cloud-artifact-registry`. Ensure you are installing it in the correct virtual environment if you are using one.","cause":"The `google-cloud-artifact-registry` Python client library has not been installed in the Python environment where the code is being executed.","error":"ModuleNotFoundError: No module named 'google.cloud.artifactregistry'"},{"fix":"Start the Docker daemon on your local machine. If connecting to a remote daemon, verify that `DOCKER_HOST` is correctly configured and the remote daemon is running and accessible.","cause":"This error occurs when the Docker client cannot establish a connection with the Docker daemon, which is a prerequisite for pushing or pulling Docker images to/from Artifact Registry.","error":"Cannot connect to the Docker daemon. Is 'docker daemon' running on this host?"},{"fix":"Double-check the package name, version, and the full repository URL used in your `pip` or `twine` command. Verify the package exists in the repository by listing its contents in the Google Cloud Console or using `gcloud artifacts packages list`.","cause":"When interacting with Python packages via `pip` or `twine`, this error indicates that the requested package or a specific version of it could not be found in the specified Artifact Registry repository, or the repository URL is incorrect.","error":"HTTP Error 404 - Not Found"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.22.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://cloud.google.com/artifact-registry","github":"https://github.com/googleapis/google-cloud-python","docs":null,"changelog":null,"pypi":"https://pypi.org/project/google-cloud-artifact-registry/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["gcp","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}