Keyring authentication to Artifact Repository not working (GCP)
Asked Answered
K

1

7

In order to set up keyring authentication to a private pip repository, I followed the steps on Setting up authentication to Python package repositories - Authenticating with keyring.

I chose to use an environment variable for the authentication. I verified it was set correctly:

abc@def:~/PycharmProjects/ghi$ echo $GOOGLE_APPLICATION_CREDENTIALS
/home/jkl/.googlekeys/serviceaccount.json

I also logged in my user using gcloud auth login. The user that is logged in is the owner of a service account that has write permission on the Artifact Registry.

Unfortunately, I get the following output when trying to install a package:

abc@def:~/PycharmProjects/ghi$ pip install stringcase
Looking in indexes: https://pypi.org/simple, https://us-west1-python.pkg.dev/mno-415182/pqr/simple/
User for us-west1-python.pkg.dev:

I expected the keyring to handle the authentication at this step. Any suggestions for determining the cause of this problem?

Karalynn answered 30/8, 2021 at 6:45 Comment(7)
Did you follow both the Keyring authentication with user credentials and Keyring authentication with service account credentials steps of the documentation? If so, this might be the problem, as they are both different methods of the final step in the authentication, the documentation can be a bit misleading on this. So try undoing the gcloud auth login and let me know if it works.Gamez
@RafaelLemos Thank you! I did indeed follow both of these steps, but after issuing gcloud auth revoke, the problem still persists.Skyway
@RafaelLemos Actually, I did get a bit further after revoking everything with gcloud auth revoke --all: it now installs packages using pip from PyPI without prompting for credentials, so maybe authentication goes well! Ultimately, I wanted to publish a package using Poetry, and that still fails (it does still prompt for credentials there). I think I should pose that question in a separate thread as it may be a Poetry issue.Skyway
So, at the end the issue was fixed? I would say that is indeed better to create a separate question for the Poetry issue, as it's a separate topic altogether.Gamez
@RafaelLemos Yes, I think this is fixed. I was able to install a package with pip and will create a separate question for Poetry. Thank you very much!Skyway
Great, I will add this into an answer then, thanks for letting me know :)Gamez
I have the same problem. I only followed the "with user credentials" step and I'm still being asked for a username and password. I went through the doc like 3 times now. I use an M1 Macbook Pro.Siobhan
G
3

As per our discussion in the comments, the problem is that you followed both the Keyring authentication with user credentials and Keyring authentication with service account credentials steps of the documentation. Those are both different methods of doing the final step in the authentication process.

To fix it all you need to do it is revoke the authentication with gcloud auth revoke --all and it will work.

Gamez answered 31/8, 2021 at 12:43 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.