astral-sh / uv

An extremely fast Python package installer and resolver, written in Rust.
https://astral.sh/
Apache License 2.0
11.74k stars 322 forks source link

uv does not support keyring after 0.1.32 #3279

Closed mvaldi closed 2 weeks ago

mvaldi commented 2 weeks ago

Hi astral team, I love this repository and save me a lot of time in github actions.

I have a problem trying to install a private repository with gcp using uv with docker

This is the dockerfile that contain the error:

Dockerfile with error ```dockerfile FROM python:3.10.14-bullseye RUN pip install -U pip "uv==0.1.33" -q ARG GOOGLE_APPLICATION_CREDENTIALS_PATH="./gcp.json" COPY $GOOGLE_APPLICATION_CREDENTIALS_PATH /tmp/credentials.json ENV GOOGLE_APPLICATION_CREDENTIALS /tmp/credentials.json RUN uv pip install --system keyring keyrings.google-artifactregistry-auth -q && uv pip install --system --keyring-provider subprocess --extra-index-url https://location-python.pkg.dev/project-id/package-name/simple private-package ```

it throw the follow error

Detailed error ``` => ERROR [4/4] RUN uv pip install --system keyring keyrings.google-artifactregistry-auth -q & 2.9s ------ > [4/4] RUN uv pip install --system keyring keyrings.google-artifactregistry-auth -q && uv pip install --system --keyring-provider subprocess --extra-index-url https://location-python.pkg.dev/project-id/package-name/simple private-package: 2.838 error: HTTP status client error (401 Unauthorized) for url (https://location-python.pkg.dev/project-id/package-name/simple/private-package/) ------ Dockerfile:11 -------------------- 9 | 10 | # RUN uv pip install --system keyring keyrings.google-artifactregistry-auth -q && uv pip install --system --keyring-provider subprocess --extra-index-url https://location-python.pkg.dev/project-id/package-name/simple private-package 11 | >>> RUN uv pip install --system keyring keyrings.google-artifactregistry-auth -q && uv pip install --system --keyring-provider subprocess --extra-index-url https://location-python.pkg.dev/project-id/package-name/simple private-package 12 | -------------------- ERROR: failed to solve: process "/bin/sh -c uv pip install --system keyring keyrings.google-artifactregistry-auth -q && uv pip install --system --keyring-provider subprocess --extra-index-url https://location-python.pkg.dev/project-id/package-name/simple private-repository" did not complete successfully: exit code: 2 ```

and this error appear for the next versions like

But if we use the uv version 0.1.32 it works

Dockerfile worked ```dockerfile FROM python:3.10.14-bullseye RUN pip install -U pip "uv==0.1.32" -q ARG GOOGLE_APPLICATION_CREDENTIALS_PATH="./gcp.json" COPY $GOOGLE_APPLICATION_CREDENTIALS_PATH /tmp/credentials.json ENV GOOGLE_APPLICATION_CREDENTIALS /tmp/credentials.json RUN uv pip install --system keyring keyrings.google-artifactregistry-auth -q && uv pip install --system --keyring-provider subprocess --extra-index-url https://location-python.pkg.dev/project-id/package-name/simple private-package ```

so, something it change and break the feature

Thanks you!

charliermarsh commented 2 weeks ago

Can you include the uv logs from running with --verbose?

mvaldi commented 2 weeks ago

Sure!

Detailed error with -v ```Dockerfile FROM python:3.10.14-bullseye RUN pip install -U pip "uv==0.1.33" -q ARG GOOGLE_APPLICATION_CREDENTIALS_PATH="./gcp.json" COPY $GOOGLE_APPLICATION_CREDENTIALS_PATH /tmp/credentials.json ENV GOOGLE_APPLICATION_CREDENTIALS /tmp/credentials.json RUN uv pip install --system keyring keyrings.google-artifactregistry-auth -q && uv pip install --system --keyring-provider subprocess --extra-index-url https://location-python.pkg.dev/project-id/package-name/simple private-package -v ``` ``` 1.163 DEBUG Starting interpreter discovery for default Python 1.163 DEBUG Cached interpreter info for Python 3.10.14, skipping probing: usr/local/bin/python3 1.163 DEBUG Using Python 3.10.14 environment at usr/local/bin/python3 1.163 DEBUG Trying to lock if free: tmp/uv-39ee7c309557c5e9.lock 1.164 DEBUG Using registry request timeout of 300s 1.164 DEBUG Solving with target Python version 3.10.14 1.164 DEBUG Adding direct dependency: private-package* 1.164 TRACE Fetching metadata for private-package from https://location-python.pkg.dev/project-id/package-name/simple/private-package/ 1.165 TRACE No cache entry exists for /root/.cache/uv/simple-v7/65a3230ca73dc537/private-package.rkyv 1.165 DEBUG No cache entry for: https://location-python.pkg.dev/project-id/package-name/simple/prisma-workflows/ 1.165 TRACE Sending fresh GET request for https://location-python.pkg.dev/project-id/package-name/simple/private-package/ 1.165 TRACE Handling request for https://location-python.pkg.dev/project-id/package-name/simple/private-package/ 1.165 TRACE No credentials on request, checking cache... 1.165 TRACE No credentials in cache. 1.165 TRACE Skipping keyring lookup for https://location-python.pkg.dev/project-id/package-name/simple/private-package/ with no username 1.165 DEBUG No credentials found for https://location-python.pkg.dev/project-id/package-name/simple/private-package/ 2.091 error: HTTP status client error (401 Unauthorized) for url (https://location-python.pkg.dev/project-id/package-name/simple/private-package/) ```
zanieb commented 2 weeks ago

Hi! You need to provide a username for keyring.

See the 0.1.33 breaking changes

mvaldi commented 2 weeks ago

wonderful! it worked, thanks you so much!

zanieb commented 2 weeks ago

You're welcome! Sorry for the breaking change — it seemed incorrect for us hard-code the username for a specific service.

mvaldi commented 2 weeks ago

For the following people who come asking the same question, this was the solution:

uv pip install --system --keyring-provider subprocess --extra-index-url https://strong>`oauth2accesstoken@`</stronglocation-python.pkg.dev/project-id/package-name/simple private-package