Closed Misterturtle closed 2 years ago
How did you install Poetry?
If via pipx try running pipx inject poetry keyrings.google-artifactregistry-auth
.
If via install-poetry.py/get-poetry.py try running poetry plugin add keyrings.google-artifactregistry-auth
If via pip either the latter or pip should do, but I doubt it would have an effect.
If you did not use pip, or if you manually created a virtual environment, poetry runs in it's own venv and does not call pip to download wheels, so the keyring backend needs to be available in it's venv. poetry plugin add
is the way poetry provides for doing that. Pipx also has it's own pipx inject
to achieve that.
I installed poetry directly with pip, which is being managed by pyenv:
pip install --upgrade poetry==1.2.0b1
$ which pip
/Users/my_user/.pyenv/versions/3.9.4/bin/pip
$ pyenv global
3.9.4
I successfully ran your suggestion for adding it as a plugin, but the error still occurs:
poetry plugin add keyrings.google-artifactregistry-auth
Furthermore, if I uninstall the keyring and try to pull a package, it asks for username/password, as opposed to when the keyring is installed, it successfully retrieves the credentials without input. Also, I am able to publish packages to Artifact Registry with the keyring. I don't believe its directly a keyring issue.
Also, for further context (albeit anecdotal), my team has been using Poetry Alpha + Keyring +Art Reg for months successfully, but suddenly we've seen all developers hitting the same issue.
Edit: Here is my keyring configuration inside the poetry venv
$ poetry run keyring --list-backends
keyring.backends.macOS.Keyring (priority: 5)
keyring.backends.fail.Keyring (priority: 0)
keyring.backends.chainer.ChainerBackend (priority: 10)
keyrings.gauth.GooglePythonAuth (priority: 9)
I've found the solution. The issue isn't with poetry, but rather with a breaking change with Artifact Registry. Based on the release notes found here: https://cloud.google.com/artifact-registry/docs/release-notes#March_01_2022
The solution is simply to update pyproject.toml with the host url as described in the release notes. The old hostname format still works via Pip, but not Poetry.
For example:
[[tool.poetry.source]]
name = "poetest"
url = "https://us-central1-pypi.pkg.dev/digital-ryan/poetest/simple/"
default = true
Becomes:
[[tool.poetry.source]]
name = "poetest"
url = "https://us-central1-python.pkg.dev/digital-ryan/poetest/simple/"
default = true
This issue can be closed, but better logging around a failure to connect would have been helpful.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
-vvv
option).Issue
Dependencies:
Artifact Registry Keyring:
pip list | grep keyring
Python Version:
python --version
Poetry Version
poetry --version
Gcloud config:
gcloud config list
Minimum Working Example: When running
poetry add poetry-test -vvv
, poetry is unable to download and install a package from GCP Artifact Registry.Proving the Artifact Registry image exists and is accessible:
Installing the same package through pip + keyring successfully downloads and installs the poetry-test package
poetry run pip install --extra-index-url https://us-central1-python.pkg.dev/digital-ryan/poetest/simple poetry-test -vvv