I want to create a shared python repository in a GCP project. When I get to upload the dist/*.whl file I am prompted for a username and password, but my pypi account (and gcp account) is Unauthorised.
Following instructions from https://cloud.google.com/artifact-registry/docs/python/store-python
gcloud config set project [my_project]
gcloud artifacts repositories create [repo] --repository-format=python --location=europe-west2 --description="Shared Python package repository"
gcloud config set artifacts/repository [repo]
python3 -m pip install --upgrade build
python3 -m build
To confirm the url.
gcloud artifacts print-settings python --project=[my_project] --repository=[repo] --location=europe-west2
I have generated a whl file in the dist folder and running the following command from the root of the project containing the dist folder.
python3 -m twine upload --repository-url https://europe-west2-python.pkg.dev/[my_project]/[repo]/ dist/*
I am prompted for my username and password. I enter my gcp account details.
Uploading distributions to https://europe-west2-python.pkg.dev/[my_project]/[repo]/ Enter your username:
In attempt to resolve this I have run revoked and rerun gcloud auth login
You are now logged in as [me@mycompany]. Your current project is [my_project]. You can change this setting by running: $ gcloud config set project PROJECT_ID
I have enabled ‘Artifact Registry API’ and the repository shows in the list.
gcloud artifacts repositories list
I have the following permissions….
Artifact Registry Administrator (1)
[me@mycompany]
Artifact Registry Create-on-Push Writer (1)
[me@mycompany]
Artifact Registry Repository Administrator (1)
[me@mycompany]
Artifact Registry Writer (1)
[me@mycompany]
I was expecting the dist files to be uploaded to the cloud artifact registry which is listed. I’ve created an PiPy account and tried my Google Cloud Account to login.
Dave Russell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.