I've been trying GCP's Artifact Registry, which is currently in alpha for Python packages.
I do the authentication via Keyring along with my service account, as explained in the documentation.
I can successfully upload a package using Twine, and I can successfully download it to a local Python project by installing the following requirements.txt
:
--extra-index-url https://my-region-pypi.pkg.dev/my-project/my-python-repo/simple/
my-package
However, when I deploy a minimal Cloud Function to the same project as my Artifact Registry, with the same requirements.txt
shown above, the deployment fails with the following output:
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: `pip_download_wheels` had stderr output:
ERROR: Could not find a version that satisfies the requirement my-package (from -r requirements.txt (line 2)) (from versions: none)
ERROR: No matching distribution found for my-package (from -r requirements.txt (line 2))
I tried with both --extra-index-url
and just plain --index-url
, with no difference. I also tried installing the keyring dependencies with the following requirements.txt
:
--extra-index-url https://my-region-pypi.pkg.dev/my-project/my-python-repo/simple/
keyring
keyrings.google-artifactregistry-auth
my-module
But I get the same error.
I checked the permissions for my default App Engine service account for my project, which is also used for Cloud Functions, and I can confirm that it has the Artifact Registry Reader role, so it doesn't seem to be a permissions issue.
I also tried deploying a minimal App Engine service instead of a Cloud Function, but I get the same error.
Many thanks for the help.